| |
e758. Getting the Items in a JComboBox Component
// Create a read-only combobox
String[] items = {"item1", "item2", "item3"};
JComboBox cb = new JComboBox(items);
// Get number of items
int num = cb.getItemCount();
// Get items
for (int i=0; i<num; i++) {
Object item = cb.getItemAt(i);
}
// [item1, item2, item3]
e756.
Creating a JComboBox Component
e757.
Getting and Setting the Selected Item in a JComboBox Component
e759.
Adding and Removing an Item in a JComboBox Component
e760.
Selecting an Item in a JComboBox Component with Multiple Keystrokes
e761.
Determining If the Menu of a JComboBox Component Is Visible
e762.
Displaying the Menu in a JComboBox Component Using a Keystroke
e763.
Displaying the Menu in a JComboBox Component Using a Keystroke If the Selected Item Is Not Unique
e764.
Setting the Number of Visible Items in the Menu of a JComboBox Component
e765.
Listening for Changes to the Selected Item in a JComboBox Component
e766.
Listening for Action Events from a JComboBox Component
e767.
Determining When the Menu of a JComboBox Component Is Displayed
© 2002 Addison-Wesley.
|