Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with resizing JComboBox

 
Mark Heydenrych
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys.

I really hope someone can help me, I'm having some weird bugs with JComboBoxes. I want to resize a combobox so that it looks, well, frankly, like a normal drop down list. Now I can modify the width without any problem. But try as I might, the height of the combobox fills the window from top to bottom. So I have a single itme in my box, which is exactly the way a want it, but I have miles of whitespace above and below this item, which I don't want. I've set the PrefferedSize, MaximumSize and MinimumSize, and they've constricted the width exactly as I wanted, but the height stubbornly refuses to change. If anybody could help me, you would make me a very happy bunny.

Thanks all
 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sounds like you are using the wrong layoutmanager.

currently you are adding the combobox to a container (panel/frame/whatever),
try adding the combobox to an intermediary panel and see what happens

instead of
container.add(comboBox);

try it like this
JPanel panel = new JPanel();//use default FlowLayout
panel.add(comboBox);
container.add(panel);

if this doesn't work, post your code so we can see what you're doing
 
Mark Heydenrych
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thank you!

You are a champion. Thanks so much dude. Worked perfectly. Looks much nicer
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic