Sunday, July 12, 2009

Shrinking combo boxes

It seemed a simple enough requirement: just shrink the fonts of my three JComboBoxes so they would fit onto my teeny weeny applet:

But, to do that you need to create your own list cell renderer, which returns a JLabel whose font is set to 9.0 points. Also, you have to change the font of the JComboBox itself, or IT will be 12pt. The result is readable and keeps the component small.

No comments:

Post a Comment