FULL PRODUCT VERSION :
java version "1.6.0_05-ea"
Java(TM) SE Runtime Environment (build 1.6.0_05-ea-b04)
Java HotSpot(TM) Client VM (build 1.6.0_05-ea-b04, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Windows XP SP2
A DESCRIPTION OF THE PROBLEM :
In Nimbus, an empty JComboBox has a very low height. When you insert the first item in it, its height grows considerably. If the JComboBox is within a fixed-size JDialog, and the initial size of the dialog is calculated based on the size of the empty combo box, if you insert an item in the combo box the dialog won't expand along with the combo box in order fully accommodate all visual components it contains.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
The following description assumes you're using NetBeans to design the JDialog, using GroupLayout as the layout manager.
- Create a non-resizable JDialog and drop a few components on it: JLabels, JTextFields, JButtons and the like. Just don't forget to drop a few JComboBoxes, and make sure they have empty models (i.e. no items);
- Make sure the dialog occupies the minimum possible size while having all components show up completely, i.e. snap all components to their default sizes, and then resize the dialog to enclose all components exactly;
- In the dialog construtor, after the call to [initComponents()], insert a few items in the combo boxes. Run your program and show the dialog. When the dialog gets shown, you will notice that the lower section of the dialog gets a bit clipped. That's because the combo boxes expanded their size when they got new items, and the dialog didn't expand in order to accommodate the extra size. If you include at least one item in each combo box in the Form Designer (this way, they won't have empty models when pack() is called in the end of initComponents()), you will see that the dialog box is displayed with the correct size.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Having the dialog show all the components completely, without any clipping in the bottom section.
The dialog doesn't show all the components completely, clipping parts of the components in the lower section. The more combo boxes you have along the vertical axis of the dialog, the more clipping you get in the lower section.
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Creating every JComboBox with at least one item in the dialog designer, so they won't be empty when the dialog's size is calculated upon calling pack() in initComponents().