Example usage for java.awt Checkbox Checkbox

List of usage examples for java.awt Checkbox Checkbox

Introduction

In this page you can find the example usage for java.awt Checkbox Checkbox.

Prototype

public Checkbox(String label) throws HeadlessException 

Source Link

Document

Creates a check box with the specified label.

Usage

From source file:RadialLayout.java

/**
 * Run a demonstration.//from ww w  .ja v a 2s  .  c om
 *
 * @param args  ignored.
 * 
 * @throws Exception when an error occurs.
 */
public static void main(final String[] args) throws Exception {
    final Frame frame = new Frame();
    final Panel panel = new Panel();
    panel.setLayout(new RadialLayout());

    panel.add(new Checkbox("One"));
    panel.add(new Checkbox("Two"));
    panel.add(new Checkbox("Three"));
    panel.add(new Checkbox("Four"));
    panel.add(new Checkbox("Five"));
    panel.add(new Checkbox("One"));
    panel.add(new Checkbox("Two"));
    panel.add(new Checkbox("Three"));
    panel.add(new Checkbox("Four"));
    panel.add(new Checkbox("Five"));

    frame.add(panel);
    frame.setSize(300, 500);
    frame.setVisible(true);
}

From source file:BenchmarkApplet.java

public void init() {
      tgroup = Thread.currentThread().getThreadGroup();

      Font font = new Font("Courier", Font.PLAIN, 10);
      FontMetrics fm = getFontMetrics(font);
      int lines = Math.max(10, size().height / fm.getHeight() - 4);

      out = new TextArea(lines, spaces.length() + Benchmark.resolutionName.length());
      out.setFont(font);//from  w w  w  . j a  v a  2  s . c o  m
      out.setEditable(false);
      add(out);

      boolean toobig;
      do {
          testList = new List(--lines, true);
          add(testList, 0);
          validate();
          if (toobig = testList.size().height - out.size().height > 2)
              remove(testList);
      } while (toobig);
      for (int ii = 0; ii < tests.length; ii++)
          testList.addItem(tests[ii].getName());
      testList.select(0); // Calibration benchmark
      testList.select(1); // Mixed benchmark

      timeEstimate = new Label(getTimeEstimate());
      add(timeEstimate);

      add(doit = new Button("Run Benchmark"));
      add(abort = new Button("Stop"));
      add(clear = new Button("Clear"));
      abort.disable();
      clear.disable();

      add(console = new Checkbox("Console"));

      validate();
  }

From source file:TextBouncer.java

protected Checkbox createCheckbox(String label, final int item) {
    Checkbox check = new Checkbox(label);
    check.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent ie) {
            setSwitch(item, (ie.getStateChange() == ie.SELECTED));
        }//from  w  ww  .  j  av  a 2 s. c o  m
    });
    return check;
}