Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

UML diagram for a java program.. Course adding system

$
0
0
Need help to create UML diagram for this program.. can anyone please guide me how to do create it. because have no idea how to create an UML diagram.. below are the two classes.. ARRAYS n COURSES...

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;


public class Arrays  extends JFrame{
      
    int NOC = 5; //No of Maximum courses that can be added
    
    JLabel code = new JLabel("Course Code");
    JLabel name = new JLabel("Course Name");
    
    // Using 2D Array to store 
    public JLabel courseCode[][] = new JLabel[NOC][2];
        
    JLabel test = new JLabel("Test");
    
    Arrays()
    {
    
   int initX = 10;
   int initY = 20;
   int delX = 0;
   int delY = 0;
   
   
   add(code);
   add(name);
   code.setBounds(10,5,100,50);
   name.setBounds(200,5,100,50);
  
   
   for  (int i = 0 ; i < NOC ;i++)
   {
        for (int j = 0 ; j <= 1 ;j++)
        {
            // Instantiation of Labels , Assigns Memory to each label 
            courseCode[i][j] = new JLabel("");
            courseCode[i][j].setBounds(initX + delX, initY + delY, 100, 50);
            add(courseCode[i][j]);
            delX = 200;
            
         }
        
        delX = 0;
        delY+=40;
   }
    
    setLayout(null); 
    setVisible(true);
    
    setSize(400,600);
    
    }
    
   }



/*Muhammad Bin Qasim
 1124641
 */
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class Courses extends JFrame
{
        int row = 0;
        int col = 0;
        int itemCount = 0;
        
        
    Courses(){
            
        final Arrays array = new Arrays();
        JLabel lab1=new JLabel("Course Code");
        final JTextField text1=new JTextField(20);

        JLabel lab2=new JLabel("Course Name");
        final JTextField text2= new JTextField(20);

       

       final JButton b=new JButton("Add");
       
        
            b.addActionListener(new ActionListener(){
           
            public void actionPerformed(ActionEvent e){  
            itemCount++;
            JOptionPane.showMessageDialog(null, "ADD COURSE #" + itemCount);
            
            array.courseCode[row][col].setText(text1.getText());
            array.courseCode[row][col+1].setText(text2.getText());  
            row++;
            col=0;  
            
            if (itemCount == 5)
            {
               JOptionPane.showMessageDialog(null, "No More Courses to ADD");             
               b.removeActionListener(this);  
               System.exit(0);
            }
            
           }
        });
           setLayout(null);
           lab1.setBounds(10,10,100,20);
           text1.setBounds(150,10,200,20);
           lab2.setBounds(10,40,100,20);
           text2.setBounds(150,40,200,20);
           
           
           b.setBounds(150,110,70,20);
           add(lab1);
           add(text1);
           add(lab2);
           add(text2);
          
           
           add(B)/>/>;
           setVisible(true);
           setSize(400,200);
        }
    public static void main(String[] args) 
    {
    new Courses();
    
    
        }
}



Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>