Basic HTML version of Foils prepared 13 October 97

Foil 38 AWT Components -- Radio Buttons , CheckboxGroup

From Java Tutorial, July 1, 1996 CSC499(JSU) CPS406/606 -- Fall Semester 97. by Nancy J. McCracken,Geoffrey C. Fox

 for Foil 38
1 Radio buttons are identical to Checkboxes but grouped so that only one checkbox in a group can be on at a time. They use same class for buttons but add CheckboxGroup class
2 CheckboxGroup cbg = new CheckboxGroup();
3 cb1 = new Checkbox("Red", cbg, false));
4 cb2 = new Checkbox("Green", cbg, false));
5 cb3 = new Checkbox("Blue", cbg, true));
6 add(cb1); add(cb2); add(cb3);
7 In addition to checking the state of checkboxes in a group, the method getCurrent returns the one checkbox which is on:
  • cb = cbg.getSelectedCheckbox();

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Wed Apr 1 1998