JCheckBox component, the JTriStateCheckBox has three states:
false value will set the unselected statefalse value will set the selected statetrue the checkbox the partial state through user clicks
true as argument, you will go to the partial state though user selections. The diagram is:
JFrame f = new JFrame("test"); f.setSize(200, 300); JTriStateCheckBox cb = new JTriStateCheckBox("Checkbox"); cb.addStateChangeListener(new TriStateChangeListener() { public void stateChanged(TriStateChangeEvent e) { System.out.println("Change : " + e.getStateChange()); } }); f.getContentPane().setLayout(new FlowLayout()); f.getContentPane().add(cs); f.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { System.exit(0); } }); f.pack(); f.setVisible(true);
Copyright 2006-2024 Herve Girod. All Rights Reserved. Documentation and source under the LGPL v2 and Apache 2.0 licences
Project Web Hosted by
Copyright 1999-2010 -
Geeknet, Inc., All Rights Reserved
About
-
Legal
-
Help