#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    7
    Rep Power
    0

    How to make this GUI window


    Hi there

    I have an assignment where I have to make a phone list GUI, and the main window of that GUI, will have to look like this:



    So I have tried with all kinds of layout, but have not succeeded really. Especially I have a hard time placing the button and adding the JList window.

    So could anyone please help on how to code this??
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    74
    Rep Power
    18
    Please show your current code
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    7
    Rep Power
    0
    Here is my source code:

    Code:
    public class PhoneListGUI implements ActionListener{
     
        JFrame guiFrame;
        JPanel buttonPanel;
        JButton button;
        JList list;
        
        public PhoneListGUI() {
    	
            guiFrame = new JFrame();
            
            //make sure the program exits when the frame closes
            guiFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            guiFrame.setTitle("Phone List");
            guiFrame.setSize(300,300);
          
            
            //This will center the JFrame in the middle of the screen
            guiFrame.setLocationRelativeTo(null);
    
            Container contentPane = guiFrame.getContentPane();      
            contentPane.setLayout(new BorderLayout());
            
    
            JPanel buttonPanel = new JPanel();
          
            JButton newButton = new JButton("New Number");
            buttonPanel.add(newButton);
            JButton delButton = new JButton("Delete Number");
          	buttonPanel.add(delButton);
          
    
          	JButton exitButton = new JButton("Exit");
          	buttonPanel.add(exitButton);
       
            list = new JList<>();
              
            contentPane.add(buttonPanel, BorderLayout.WEST);
            contentPane.add(list, BorderLayout.EAST);
    
            guiFrame.setVisible(true);
        }
    
    	@Override
    	public void actionPerformed(ActionEvent e) {
    		// TODO Auto-generated method stub
    		
    	}
    }
    It seems the JList is not really displayed... I have a main where I create an instance of PhoneListGUI.

IMN logo majestic logo threadwatch logo seochat tools logo