// This Class is (c)opyright 1999 by Geoff Knagge. It may be freely used
// for any non-commercial purpose on the following conditions:
//   1.	You indemnify the copyright holder of all possible liability
//  	resulting from its use.
//   2.	You provide a link back to the source of this file, that is
//	http://browse.to/gogogeoff
//
// Use of this class shows your agreement to the above.

import java.awt.*;

public class TrueFalse extends Panel {
// A label next to a Yes/No pair of radio buttons, all contained in a
// Panel.

	Checkbox yes;

	public boolean getValue() {
		return yes.getState();
	}

	public TrueFalse(String name, boolean def)  {
		setLayout(new GridLayout(1,2));
		Label namelab = new Label(name);
		CheckboxGroup status = new CheckboxGroup();
		yes = new Checkbox("Yes");
		Checkbox no = new Checkbox("No");
		yes.setCheckboxGroup(status); // tie the two checkboxes
		no.setCheckboxGroup(status);  // to the one group to make
					      // them radiobuttons
		yes.setState(def);
		no.setState(! def);
		add(namelab);
		Panel p2 = new Panel();
		add(p2);
		p2.setLayout(new GridLayout(1,2));
		p2.add(yes);
		p2.add(no);
	}
}