Section 12.11 JComboBox; Using an Anonymous Inner Class for Event Handling

• A JComboBox (p. 504) provides a list of items from which the user can make a single selection. JComboBoxes generate ItemEvents.

• Each item in a JComboBox has an index (p. 507). The first item added to a JComboBox appears as the currently selected item when the JComboBox is displayed.

JComboBox method setMaximumRowCount (p. 507) sets the maximum number of elements that are displayed when the user clicks the JComboBox.

• An anonymous inner class (p. 507) is a class without a name and typically appears inside a method declaration. One object of the anonymous inner class must be created when the class is declared.

JComboBox method getSelectedIndex (p. 508) returns ...

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.