Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JComboBox

 
John Brookes
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a few JComboBox instances in a GUI I've made. They all start off empty and get populated by the user, but because they start empty they look rubbish on the screen. I can't for the life of me find a way to set a default string to appear in an otherwise empty combo box. I just want to put in "-----" or something to set an initial size.
 
Campbell Ritchie
Marshal
Posts: 52663
121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried setting them invisible (setVisible(false)) before they are populated??? Or maybe setPopupVisible()?
 
John Brookes
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah good call. I'll give it a go but I'd rather have them in place with a default string to keep the layout more consistent.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
It's just a flesh wound! Or a tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!