Posted by castelaz
on October 19, 2004 at 7:32 PM PDT
A dropdown combobox is an extremely useful control, but its associated button isn't really needed until the control has focus. A small UI trick can help you maximize precious screen space by hiding the dropdown button until it's needed. You can size the combobox control to show all of the selected item text without wasting space on the button.
Way back in the primordial ooze stage of our new product, it was decided that we needed a custom control rather than use the standard combobox to handle dropdown lists. So, instead of using a JComboBox, we created our own LookupField control that combined a JTextField with a JButton to simulate the more traditional component. There were several reasons for this decision. Two of the more compelling ones had to do with the ability to control the dropdown button. First, it was felt that the standard button on the JComboBox was too wide. We could easily set a narrower width for the button in our custom control. Second, we could completely hide the custom control