Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

JComboBox

 
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.
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • 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 Spring Java
  • 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
 
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at the SteppedCombo example.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic