List of utility methods to do JCheckBox
JCheckBox | addCheckBox(Container container, String label, String placement, boolean debug) Add a check box (with label) to parent container JCheckBox checkBox = new JCheckBox(label); container.add(checkBox, placement); checkBox.setOpaque(false); return checkBox; |
String | convertToYesNo(JCheckBox checkBox) convert To Yes No if (checkBox.isSelected()) return "Yes"; return "No"; |
JCheckBox | createCheckBox(final String title, final Preferences node, final String pref_name, final boolean default_val) create Check Box final JCheckBox check_box = new JCheckBox(title); check_box.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent ae) { node.putBoolean(pref_name, check_box.isSelected()); }); check_box.setSelected(node.getBoolean(pref_name, default_val)); ... |
JCheckBox | createCheckBox(String name, String command, boolean selected) create Check Box return createCheckBox(null, name, command, selected);
|
JCheckBox | createCheckBox(String s, boolean b) Builds a personalized checkbox using a smaller than usual font. JCheckBox cb = new JCheckBox(" " + s + " ", b); cb.setFont(new Font("serif", Font.PLAIN, 12)); cb.setHorizontalAlignment(JCheckBox.LEFT); return cb; |
JCheckBox | createJCheckBox(Rectangle bounds) Creates a new JCheckBox object with the given properties.
JCheckBox jCheckBox = new JCheckBox(); jCheckBox.setBounds(bounds); return jCheckBox; |
void | exclusive(final JCheckBox first, final boolean firstState, final JCheckBox second, final boolean secondState) Declares states for two checkboxes to be mutually exclusive. ActionListener l = new ActionListener() { private void check(final JCheckBox checked, final boolean checkedState, final JCheckBox changed, final boolean impliedState) { if (checked.isSelected() == checkedState) { changed.setSelected(impliedState); changed.setEnabled(false); } else { changed.setEnabled(true); ... |
void | imply(final JCheckBox checked, final boolean checkedState, final JCheckBox changed, final boolean impliedState) Checks state of the checked checkbox and if state is checkedState than to disable changed checkbox and change its state to impliedState . ActionListener l = new ActionListener() { Boolean previousState; public void actionPerformed(ActionEvent e) { if (checked.isSelected() == checkedState) { if (previousState == null) { previousState = changed.isSelected(); changed.setEnabled(false); ... |
void | initJCheckBox(JCheckBox box, String element) Initiates the Check Box box.setSelected(Boolean.parseBoolean(element)); |
boolean | isCheckBoxModified(JCheckBox checkBox, boolean originalValue) is Check Box Modified return checkBox.isSelected() != originalValue;
|