Example usage for javax.swing JCheckBox JCheckBox

List of usage examples for javax.swing JCheckBox JCheckBox

Introduction

In this page you can find the example usage for javax.swing JCheckBox JCheckBox.

Prototype

public JCheckBox(Action a) 

Source Link

Document

Creates a check box where properties are taken from the Action supplied.

Usage

From source file:Main.java

public static void main(String[] args) {
    JCheckBox a = new JCheckBox("A");
    a.setSelected(true);//from ww w  . j  a  v a  2 s.  c  o  m
    JCheckBox b = new JCheckBox("B");
    JCheckBox c = new JCheckBox("C");
    JCheckBox d = new JCheckBox("D");

    JFrame frame = new JFrame();
    frame.setLayout(new FlowLayout());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.add(new JLabel("Car Features"));
    frame.add(a);
    frame.add(b);
    frame.add(c);
    frame.add(d);
    frame.pack();
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    JButton button = new JButton("Button");
    button.setMnemonic('B');
    JCheckBox checkBox = new JCheckBox("CheckBox");
    checkBox.setMnemonic('C');
}

From source file:Main.java

public static void main(String[] args) {
    JCheckBox a = new JCheckBox("A");
    a.setSelected(true);/*www .  j a  va2  s .  c  o  m*/
    a.setMnemonic(KeyEvent.VK_A);

    JCheckBox b = new JCheckBox("B");
    JCheckBox c = new JCheckBox("C");
    JCheckBox d = new JCheckBox("D");

    JFrame frame = new JFrame();
    frame.setLayout(new FlowLayout());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.add(new JLabel("Car Features"));
    frame.add(a);
    frame.add(b);
    frame.add(c);
    frame.add(d);
    frame.pack();
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String args[]) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JCheckBox checkBox = new JCheckBox("A");

    checkBox.setToolTipText("Italic font");

    frame.add(checkBox, BorderLayout.NORTH);
    frame.setSize(300, 100);//from   ww w.ja v a 2  s  . co  m
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("Selecting CheckBox");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JCheckBox checkBox = new JCheckBox("Hi");

    checkBox.getModel().setMnemonic((char) 'H');

    frame.add(checkBox, BorderLayout.NORTH);
    frame.setSize(300, 100);/*from  ww  w . ja  va  2 s  . com*/
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("Selecting CheckBox");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JCheckBox checkBox = new JCheckBox("Hi");

    checkBox.getModel().setSelected(true);

    frame.add(checkBox, BorderLayout.NORTH);
    frame.setSize(300, 100);//from  w w w.ja  va  2s  . co  m
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("Selecting CheckBox");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JCheckBox checkBox = new JCheckBox("Hi");

    checkBox.getModel().setPressed(true);

    frame.add(checkBox, BorderLayout.NORTH);
    frame.setSize(300, 100);//from   ww w.  jav  a  2s.  co  m
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("Selecting CheckBox");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JCheckBox checkBox = new JCheckBox("Hi");

    checkBox.getModel().setRollover(true);

    frame.add(checkBox, BorderLayout.NORTH);
    frame.setSize(300, 100);// w  w  w .j av  a  2s  .c o m
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("Selecting CheckBox");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JCheckBox checkBox = new JCheckBox("Hi");

    checkBox.getModel().setArmed(false);

    frame.add(checkBox, BorderLayout.NORTH);
    frame.setSize(300, 100);/* w  ww .  jav  a  2 s .  c  o m*/
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("Selecting CheckBox");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JCheckBox checkBox = new JCheckBox("Hi");

    checkBox.getModel().setEnabled(false);

    frame.add(checkBox, BorderLayout.NORTH);
    frame.setSize(300, 100);/*from w ww  .ja v a  2 s .com*/
    frame.setVisible(true);
}