I programmed a JFrame that JPanel adds, and this adds my JCombobox. My problem is that JCombobox will not display directly until I resize my frame.
Here is my code:
frame = new JFrame("Frame");
frame.setBounds(0, 0, 900, 800);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
panel = new JPanel();
panel.setBounds(frame.getBounds());
panel.setVisible(true);
panel.setLayout(null);
panel.addMouseListener(m);
String comboBoxListe[] = { "1", "2", "3" };
JComboBox chooser = new JComboBox(comboBoxListe);
chooser.setSize(200, 25);
chooser.setLocation(30, 30);
chooser.setVisible(true);
panel.add(chooser);
frame.add(panel);
Can anyone understand what I did wrong? Thanks for the help:)
source
share