…
String[] petStrings = { "Bird", "Cat", "Dog", "Rabbit", "Pig" };
//Create the combo box, select item at index 4.
//Indices start at 0, so 4 specifies the pig.
JComboBox petList = new JComboBox(petStrings);
petList.setSelectedIndex(4);
petList.addActionListener(this);
Tham khảo thêm tại https://docs.oracle.com/javase/tutorial/uiswing/examples/components/index.html#ComboBoxDemo
» Tin mới nhất:
» Các tin khác: