I created a GUI from netbeans, in which I also placed a combo box.
By default, items in combobox are item1, item2, item3, item4.
But I need my own items. Netbeans does not allow editing the generated code, since I can edit comnbobox for me.
Note. I know one method when editing the "model" property of this jComboBox, but I do not want to do it this way because I want this jComboBox to have different elements (which are in the array), so I want to go through this array in this jComboBox looks in the following way:
jComboBox2 = new javax.swing.JComboBox(); String [] date = new String[31]; for(int i = 0; i < 31; i++) { date[i] = i + 1; } jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(date));
java jcombobox netbeans
Yatendra goel
source share