12.10.2 JRadioButton
Radio buttons (declared with class JRadioButton
) are similar to checkboxes in that they have two states—selected and not selected (also called deselected). However, radio buttons normally appear as a group in which only one button can be selected at a time (see the output of Fig. 12.20). Radio buttons are used to represent mutually exclusive options (i.e., multiple options in the group cannot be selected at the same time). The logical relationship between radio buttons is maintained by a ButtonGroup object (package javax.swing
), which itself is not a GUI component. A ButtonGroup
object organizes a group of buttons and is not itself displayed in a user interface. Rather, the individual JRadioButton
objects from the group ...
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.