Search code examples
javaswingcomponentsjcombobox

JCombobox drop-down list is not large enough to show all items


When I run the application and I click on the JCombobox for the first time, the drop-down list looks like this

enter image description here

The second time I click, it seems to rearrange everything and all items are shown.

enter image description here

Any idea why this may be happening? I would appreciate your help.


Solution

  • SOLVED: I was adding the JComboBox instance to the panel before adding the items to the JComboBox.