Mutually Exclusive Groups of Checkboxes

It is often the case that a group of checkboxes is used to represent a set of mutually exclusive options. Our next applet adds a pair of checkboxes to a checkbox group to facilitate choosing whether to print all the pages of a hypothetical document or whether to print only a specified range of pages. When the Print All checkbox is checked, the labels and textfields associated with range printing are disabled. Likewise, checking the Print Range checkbox enables the labels and textfields, in addition to requesting focus for the starting page textfield.

Figure 13-2 shows two snapshots of the applet, one with the Print All checkbox checked, and another with the Print Range checkbox checked.

Figure 13-2. CheckboxTest2 ...

Get Graphic Java™ 1.2, Volume I: AWT, Third 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.