Results 1 to 2 of 2
  1. #1
    nickburris is offline Member
    Join Date
    Jan 2011
    Rep Power

    Default How to set the size of a JComboBox?

    I have a JComboBox and I can't figure out how why, but it takes up the whole window, even if I resize the window itself.

    Java Code:
    String[] firstOptions = {"--Pick one--", "One", "Second", "Next", "Testing"};
    	       JComboBox firstValue = new JComboBox(firstOptions); 
    	       firstValue.setPreferredSize(new Dimension(300, 100)); 
    	       frame.getContentPane().add(firstValue, BorderLayout.NORTH);
    Even though Dimension(300, 100) is smaller than my JFrame window, the JComboBox still takes up the whole window.

    Any help? I'm a little new to Java

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    New Zealand
    Rep Power

Similar Threads

  1. JComboBox
    By Java_25 in forum New To Java
    Replies: 10
    Last Post: 04-20-2011, 06:39 PM
  2. Replies: 2
    Last Post: 12-10-2009, 01:58 PM
  3. Setting frame size to the size of an image
    By Yoruichi in forum AWT / Swing
    Replies: 5
    Last Post: 04-22-2009, 04:37 PM
  4. JCombobox
    By daniel50096230 in forum NetBeans
    Replies: 1
    Last Post: 09-21-2008, 12:23 PM
  5. jcombobox
    By Freddie in forum AWT / Swing
    Replies: 4
    Last Post: 05-11-2007, 12:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts