This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Can I make drop-down of JCombobox wider than text field? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Can I make drop-down of JCombobox wider than text field?" Watch "Can I make drop-down of JCombobox wider than text field?" New topic
Author

Can I make drop-down of JCombobox wider than text field?

David Chen
Ranch Hand

Joined: Jan 06, 2002
Posts: 57
Hi, there:

Here is my issue on JComboBox, it seems that the drop-down list box always has the same width as input text field of a combo box. For example in my GUI requirements, I want the input text field of a combobox contains 10 characters only, however, when user clicks on the combobox, a list of choices drops down should be about 30 characters wide. Is that possible in java? if so, how to implement that kind of combobox?

Really appreciated any suggestion or comment, thanks a lot in advance.

David
David Chen
Ranch Hand

Joined: Jan 06, 2002
Posts: 57
Got the answer from sun java forum, so, if interested, you can check following link to get sample code for stepped combobox:

http://www.java2s.com/ExampleCode/Swing-Components/SteppedComboBoxExample.htm
Mark Newton
Ranch Hand

Joined: Jan 31, 2006
Posts: 129
Originally posted by David Chen:
Got the answer from sun java forum, so, if interested, you can check following link to get sample code for stepped combobox:

http://www.java2s.com/ExampleCode/Swing-Components/SteppedComboBoxExample.htm


This was exactly what I was looking for, thanks David, if you're still around, one thing - for anyone interested in the future, this link has changed to:
http://www.java2s.com/Code/Java/Swing-Components/SteppedComboBoxExample.htm
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can I make drop-down of JCombobox wider than text field?
 
Similar Threads
JComboBox Question
JCombo box auto find
JCombobox in JTable cell does not dropdown
combox
Drop Down List + TextField combo widget