I am adding a JComboBox to a JPanel which is added to a JFrame. The code compiles fine and launches as expected, however, when I go to my panel, it looks as if the combo box isn't there. But, when I click where the combo box should be, I get the drop down of selections. I also added an actionListener to print out the selected value, which worked as expected. However, the selected values is not set in the combo box. And if I set the background to white, the combo box shows up, but looks like a textfield - no drop down arrow. Everything else in my panel works fine - buttons, labels, textfields, and tables. Could this have anything to do with the look and feel? I have also tried various sizes for both panel and combo box with no luck.
I am running windows XP Home and using the 1.4.2 JDK.
Any ideas?
Here is a code sample:
I am running windows XP Home and using the 1.4.2 JDK.
Any ideas?
Here is a code sample:
Code:
JComboBox cbxTest = new JComboBox(new String [] {"option 1", "option 2", "option3"});
cbxTest.setEditable(false);
cbxTest.setSize(150,20);
cbxTest.setLocation(5,5);
panel.add(cbxTest);