Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Put the plastic array into the drop-down list of java swing.
Put the plastic array into the drop-down list of java swing.
The following is the correct spelling, you can try it. As for the reason, the construction method of JComboBox requires you to pass in a custom one.

ComboBoxModel, you don't need it here, just use the DefaultComboBoxModel that comes with JComboBox. Is to create with a parameterless construction method. Then call addItem to fill in the display data.

JComboBox comboBox = new JComboBox();

comboBox.setBounds(50,50,50,50);

for(int I = 1900; I & lt20 13; i++) {

combobox . additem(integer . value of(I));

}

Add (combo box);

set visible(true);