Category: Lists Combo Box and Spinners

Spinner Editors

Spinner Editors

You probably noticed that the JSpinner class also includes several inner classes. These inner classes provide basic editors (and renderers) for spinners for each of the major model types. While you’ll typically rely on...

Spinners

Spinners

You might be wondering just what a spinner is. It’s a new 1.4 component similar to the JComboBox, but it shows only one item. It includes up and down arrows to “scroll” through its...

The JComboBox Class

The JComboBox Class

JComboBox combines a button or editable field and a drop-down list. It is very similar to the AWT Choice component and even implements the ItemSelectable interface for backward compatibility. By default, the JComboBox component...

Combo Boxes

Combo Boxes

A combo box component is actually a combination of a Swing list (embedded in a pop-up window) and a text field. Because combo boxes contain a list, many of the classes discussed earlier, are...

The JList Class

The JList Class

The JList class is the generic Swing implementation of a list component. In the default selection mode, you can make multiple selections by clicking with the mouse while holding down the modifier key defined...

Handling Selections

Handling Selections

The JList class in Swing depends on a second model, this one to monitor the elements that have been selected by the user. As with the list data model, the programmer is given many...

Lists

Lists

A list is a graphical component that presents the user with choices. Lists typically display several items at a time, allowing the user to make either a single selection or multiple selections. In the...