private String stringComboBoxElement[] = {"Roll", "SetCode", "Answers", "Others"};
contentPane = new JPanel();
contentPane.setLayout(null);
comboBoxfields = new JComboBox(stringComboBoxElement);
comboBoxfields.setBounds(180, 50, 120, 30);
comboBoxfields.setFont(new Font("sansserif", Font.TRUETYPE_FONT | Font.PLAIN, 15));
comboBoxfields.setBorder(new SoftBevelBorder(BevelBorder.LOWERED));
if(stringComboBoxElement.length > 5)
comboBoxfields.setMaximumRowCount(5);
else
comboBoxfields.setMaximumRowCount(stringComboBoxElement.length);
comboBoxfields.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if(e.getStateChange() == ItemEvent.SELECTED)
textFieldName.setText((String) e.getItem());
}
});
contentPane.add(comboBoxfields);
i did everything but the JComboBox doesn't appear in the window . What's the problem and how can i fix it ? To upload the full code isn't possible. The problem lies here without it everything is working properly. Can anyone help me please?