How to use JCheckBox in netbeans..

A javax.swing.JCheckBox shows a small box that is either marked or unmarked. When you click on it, it changes from checked to unchecked or vice versa automatically. You don’t have to do any programming for the checkbox to change.

There are two ways to use a checkbox:

  • Active. Use addActionListeneror addItemListener() so that a method will be called whenever the checkbox is changed.
  • Passive. Use isSelected() to test if a checkbox is checked.