File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes JComboBox - a constant size Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "JComboBox - a constant size" Watch "JComboBox - a constant size" New topic

JComboBox - a constant size

Vishwa Kumba
Ranch Hand

Joined: Aug 27, 2003
Posts: 1066
Started working on my assignment again after a looooooong time.

I have a pretty basic question now.
I am using a JCombobox in my JPanel layout to implement the Search functionality. It expands to fit in the largest entry in the list.

Is there a way I could make it a constant size, so that irrespective of the data entries, it just shows a constant width?
Ta Ri Ki Sun
Ranch Hand

Joined: Mar 26, 2002
Posts: 442
There's a setting on thge combobox for the max visible entries, have a squizz at the javadoc for what it is but it makes the combo box scroll so you can see the other entries.
It is sorta covered in the JavaRanch Style Guide.
subject: JComboBox - a constant size
jQuery in Action, 3rd edition