void setSelectedIndex(int anIndex) Selects the item at index anIndex. void setSelectedItem(Object anObject) Sets the selected item in the combo box display area to the object in the argument.
JComboBox test = JComboBox();test.addItem("another"); test.addItem("this");test.setSelectedItem("this");
fontComBox.addItem("b");
fontComBox.addItem("c");
fontComBox.addItem("d");
fontComBox.addItem("e");
//设计e为默认项
fontComBox.setSelectedItem("e");
Selects the item at index anIndex.
void setSelectedItem(Object anObject)
Sets the selected item in the combo box display area to the object in the argument.
test.addItem("this");test.setSelectedItem("this");