CheckButtons ermöglichen im Gegensatz zu RadioButtons auch eine Mehrfachauswahl.
import java.awt.*;
class RadioButtonTest extends Frame {
RadioButtonTest() {
setLayout (new GridLayout(3,1,15,10));
CheckboxGroup gruppe = new CheckboxGroup();
Checkbox rad_butt1 = new Checkbox("1", gruppe, true);
Checkbox rad_butt2 = new Checkbox("2", gruppe, false);
Checkbox rad_butt3 = new Checkbox("3", gruppe, false);
add (rad_butt1);
add (rad_butt2);
add (rad_butt3);
}
public static void main (String args[]) {
RadioButtonTest app = new RadioButtonTest();
app.setTitle("RadioButtons");
app.setLocation(100,100);
app.setSize(200,100);
app.show();
}
}