Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / August 2005

Tip: Looking for answers? Try searching our database.

Different height at JComboBox editor and renderer

Thread view: 
bobjan - 28 Aug 2005 12:41 GMT
I want to use JComboBox to enabe user to select from a list of images.
I also want that after the selection is made, only the name associated
to the image is shown at JComboBox text field part(next to the button,
or the button itself if the combo box is uneditable).

I tried with custom ComboBoxEditor and ListCellRenderer, the renderer
to show images, and the editor to show the name.
It works, but I can not adjust different heights. When I specify the
"normal" text height at ListCellRenderer, the images shown are
narrowed. When I try with the image dimension, the name text is
extremly high. It seems that I can not have different heights of those
two JComboBox components. Is there a way I can accomplish this ?
Thomas Hawtin - 28 Aug 2005 13:55 GMT
> I want to use JComboBox to enabe user to select from a list of images.
> I also want that after the selection is made, only the name associated
[quoted text clipped - 8 lines]
> extremly high. It seems that I can not have different heights of those
> two JComboBox components. Is there a way I can accomplish this ?

I believe the problem is that combo box uses (possibly from the PL&F)
the ListCellRenderer to paint the field when it is not being edited.
What you need to do is return an appropriate component (e.g. the editor)
from ListCellRenderer.getListCellRendererComponent when the index is -1.

Tom Hawtin
Signature

Unemployed English Java programmer
http://jroller.com/page/tackline/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.