O'Reilly logo

Java™ Design Patterns: A Tutorial by James W. Cooper

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 29. Radio Buttons and Toolbars

Swing provides separate implementations of both the JRadioButton and the JCheckBox. A check box has two states, and within a group of check boxes, any number can be selected or deselected. Radio buttons should be grouped into aButtonGroup object so that only one radio button of a group can be selected at a time.

Radio Buttons

Both radio buttons and check boxes can be instantiated with an image as well as a title, and both can have rollover icons. The JCheckBox component is derived from the simpler JToggleButton object. JToggleButton is a button that can be switched between two states by clicking but which stays in that new state (up or down) like a two-state check box does. Further, the JToggle Button can take ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required