Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JComboBox

 
red goliath
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have implemented JComboBox in my screen. But id gets displayed only with Vertical scroll bar.
How can i enable it with horizontal scroll bar.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
red goliath,

Please re-register with a user name that follows the guidelines in the Official JavaRanch User Name Convention. Your name is required to be in the format "First Name" + space + "Last Name" and NOT be obviously fake.

Thanks,
-Nate
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To answer your question about the combo box. You can't... At least not with the default JComboBox. You could do this by extending ComboBoxUI (or one of the many classes this class calls) to replace the JList that it is using with a series of JLabels in a JScrollPane. But I think that it's better to just rephrase the text in your JComboBox so it isn't so long. Most users aren't going to take the time to scroll through long sentences in a ComboBox. And if the text can't be cut down to fit, I'd use something like a series of JRadioButtons of JCheckBoxes in a ButtonGroup and put them in a JScrollPane.

-Nate
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at the SteppedCombo example.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic