Java Code Examples for javax.swing.JCheckBox#setMargin()

The following examples show how to use javax.swing.JCheckBox#setMargin() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CheckBoxPanel.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/** Instantiates a new check box panel. */
public CheckBoxPanel() {
    setOpaque(false);
    checkBox = new JCheckBox();
    checkBox.setMargin(new Insets(0, 0, 0, 0));
    label = new TreeLabel();
    setLayout(new BorderLayout());
    add(checkBox, BorderLayout.WEST);

    Border border = label.getBorder();
    Border margin = new EmptyBorder(0, 3, 0, 0);
    label.setBorder(new CompoundBorder(border, margin));

    add(label, BorderLayout.CENTER);

    Boolean booleanValue = (Boolean) UIManager.get("Tree.drawsFocusBorderAroundIcon");
    checkBox.setFocusPainted((booleanValue != null) && (booleanValue.booleanValue()));

    selectionForeground = UIManager.getColor("Tree.selectionForeground");
    textForeground = UIManager.getColor("Tree.textForeground");
}
 
Example 2
Source File: JCheckBoxIcon.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public JCheckBoxIcon(boolean selected, Dimension dimension) {
    this.selected = selected;
    this.dimension = dimension;
    BorderLayout layout = new BorderLayout();
    this.delegate = new JPanel(layout, false);
    this.delegate.setBorder(null);
    this.delegate.setOpaque(false);
    JCheckBox jCheckBox = new JCheckBox(null, null, selected);
    jCheckBox.setMargin(new Insets(0, 0, 0, 0));
    this.delegate.add(jCheckBox, BorderLayout.CENTER);
    this.delegate.setSize(jCheckBox.getPreferredSize());
    this.delegate.addNotify();
    this.delegate.validate();
}
 
Example 3
Source File: BooleanParameter.java    From mzmine2 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public JCheckBox createEditingComponent() {
  JCheckBox checkBox = new JCheckBox();
  checkBox.setMargin(new Insets(0, 7, 0, 0));
  return checkBox;
}