JComboBox shows blank, white box in place of item drop-down list when toggling setEnabled() function

287 views Asked by At

Using Java's WindowBuilder to create a GUI where a JComboBox is changed from enabled to un-enabled when a certain JToggleButton is pressed. Basically, when Button A is toggled on, Button B becomes toggled off, and vice versa. When Button A is toggled on, JComboBox A becomes enabled and disables JComboBox B, and vice versa for when Button B is toggled on (JComboBox B is enabled and ComboBox A is disabled).

So, the scenario: I run the program and press Button A, then select an item from ComboBox A. Button B is switched on, so ComboBox A is disabled and ComboBox B enabled. But when I switch back to Button A and try to open ComboBox A, instead of the drop-down of items, a white box appears. When I click on the white box, it selects an item and shows it, but the initial display is just a white drop-down.

Not sure why this is, and it's strange because the items are still there, just not exactly visible until I click on the blank, white box. Then one of the items shows that it was selected.

Thanks

0

There are 0 answers