List of utility methods to do JCheckBox
void | link(final JCheckBox box, final JComponent... comps) link update(box, comps); box.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { update(box, comps); }); |
JCheckBox | newJCheckBox() new JCheckBox final JCheckBox[] jCheckBox = new JCheckBox[1]; try { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { jCheckBox[0] = new JCheckBox(); jCheckBox[0].setBorderPainted(true); }); } catch (InterruptedException | InvocationTargetException e) { return jCheckBox[0]; |
JCheckBox | newJCheckBox(String n, char m) new J Check Box return newJCheckBox(n, m, false);
|
void | onCheckBoxChange(JCheckBox field, final Runnable task) on Check Box Change field.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { task.run(); }); |
void | setDependency(final JCheckBox master, final JCheckBox slave) Adds dependancy between two check boxes, so that the slave is enabled only when master is checked. if (master == null || slave == null) return; slave.setEnabled(master.isSelected()); master.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { slave.setEnabled(master.isSelected()); }); ... |
void | setSelectedWithClick(JCheckBox checkBox, boolean selected) Calls #doClick so that events are fired. checkBox.setSelected(!selected); checkBox.doClick(); |
void | update(JCheckBox box, JComponent... comps) update for (JComponent comp : comps) {
comp.setEnabled(box.isSelected());
|
void | updateCheckBoxState(final JCheckBox aCheckBox, final boolean aEnabled) Updates the enabled state of the given checkbox. if (!aEnabled) {
aCheckBox.setSelected(false);
aCheckBox.setEnabled(aEnabled);
|