12.11 JComboBox; Using an Anonymous Inner Class for Event Handling
A combo box (sometimes called a drop-down list) enables the user to select one item from a list (Fig. 12.22). Combo boxes are implemented with class JComboBox, which extends class JComponent
. JComboBox
is a generic class, like the class ArrayList
(Chapter 7). When you create a JComboBox
, you specify the type of the objects that it manages—the JComboBox
then displays a String
representation of each object.
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.