/* * Copyright (c) 1995-1997 Sun Microsystems, Inc. All Rights Reserved. * * Permission to use, copy, modify, and distribute this software * and its documentation for NON-COMMERCIAL purposes and without * fee is hereby granted provided that this copyright notice * appears in all copies. Please refer to the file "copyright.html" * for further important copyright and licensing information. * * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. */ /* * 1.0 version. * * Modified by Chris Johnson * johnson@dcs.gla.ac.uk * * Date: 21/10/98 * * Description: the original example had simple check boxes and a radio button group. * I tried to simplify it be splitting the example into two. */ import java.awt.*; import java.applet.Applet; public class SimpleCheckbox extends Applet { public void init() { Panel p1; Checkbox cb1, cb2, cb3; //independent checkboxes //Build first panel, which contains independent checkboxes cb1 = new Checkbox(); cb1.setLabel("Checkbox 1"); cb2 = new Checkbox("Checkbox 2"); cb3 = new Checkbox("Checkbox 3"); cb3.setState(true); p1 = new Panel(); p1.setLayout(new FlowLayout()); //Using a GridLayout didn't work--kept box and text too far apart. p1.add(cb1); p1.add(cb2); p1.add(cb3); //Add panels to the Applet. Put in for future extension setLayout(new GridLayout(0, 1)); add(p1); validate(); } }