HELP! * YELLOW=global GREY=local Global HTML version of Foils prepared 4 February 97

Foil 9 AWT Components -- Radio Buttons , CheckboxGroup

From Feb 3 Delivered Lecture for Course CPS616 -- Java Lecture 4 -- AWT Through I/O CPS616 spring 1997 -- Feb 3 1997. by Nancy McCracken * See also color IMAGE
Secs 113.7
Radiobuttons are identical to Checkbox's 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
CheckboxGroup cbg = new CheckboxGroup();
cb1 = new Checkbox("Red", cbg, false));
cb2 = new Checkbox("Green", cbg, false));
cb3 = new Checkbox("Blue", cbg, true));
add(cb1); add(cb2); add(cb3);
In addition to checking the state of checkboxes in a group, the method getCurrent returns the one checkbox which is on:
  • cb = cbg.getCurrent();


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 Sun Feb 16 1997