Java Code Examples for javax.swing.JCheckBox#setFocusPainted()
The following examples show how to use
javax.swing.JCheckBox#setFocusPainted() .
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: MuleModulesCheckBoxList.java From mule-intellij-plugins with Apache License 2.0 | 6 votes |
public Component getListCellRendererComponent( JList<? extends JCheckBox> list, JCheckBox value, int index, boolean isSelected, boolean cellHasFocus) { JCheckBox checkbox = value; //Drawing checkbox, change the appearance here /* checkbox.setBackground(isSelected ? getSelectionBackground() : getBackground()); checkbox.setForeground(isSelected ? getSelectionForeground() : getForeground()); */ checkbox.setEnabled(isEnabled()); checkbox.setFont(getFont()); checkbox.setFocusPainted(false); checkbox.setBorderPainted(true); checkbox.setBorder(isSelected ? UIManager .getBorder("List.focusCellHighlightBorder") : noFocusBorder); return checkbox; }
Example 2
Source File: CheckBoxPanel.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** 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 3
Source File: NullableObject.java From jclic with GNU General Public License v2.0 | 6 votes |
/** Creates new NullableObject */ public NullableObject() { super(new java.awt.BorderLayout()); setOpaque(false); nullValue = true; check = new JCheckBox(); check.setPreferredSize(checkDim); check.setMinimumSize(checkDim); check.setFocusPainted(false); check.setSelected(false); add(check, java.awt.BorderLayout.WEST); button = buildButton(); button.setPreferredSize(btDim); button.setMinimumSize(btDim); button.setFocusPainted(false); add(button, java.awt.BorderLayout.CENTER); check.addActionListener(this); button.addActionListener(this); }
Example 4
Source File: SettingsPage.java From xdm with GNU General Public License v2.0 | 5 votes |
private JCheckBox createCheckBox(String name, Font font) { JCheckBox chk = new JCheckBox(StringResource.get(name)); chk.setName(name); chk.setIcon(ImageResource.getIcon("unchecked.png", 16, 16)); chk.setSelectedIcon(ImageResource.getIcon("checked.png", 16, 16)); chk.setOpaque(false); chk.setFocusPainted(false); chk.setForeground(Color.WHITE); chk.setFont(font); return chk; }
Example 5
Source File: CustomCheckBoxList.java From tmc-intellij with MIT License | 5 votes |
@Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JCheckBox checkbox = (JCheckBox) value; checkbox.setBackground(isSelected ? getSelectionBackground() : getBackground()); checkbox.setForeground(isSelected ? getSelectionForeground() : getForeground()); checkbox.setFont(getFont()); checkbox.setFocusPainted(false); checkbox.setBorderPainted(false); checkbox.setBorder( isSelected ? UIManager.getBorder("List.focusCellHighlightBorder") : new EmptyBorder(1, 1, 1, 1)); return checkbox; }
Example 6
Source File: CheckBoxList.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
@Override public Component getListCellRendererComponent(JList<? extends E> list, E value, int index, boolean isSelected, boolean cellHasFocus) { JCheckBox checkbox = (JCheckBox) value; checkbox.setBackground(isSelected ? getSelectionBackground() : getBackground()); checkbox.setForeground(isSelected ? getSelectionForeground() : getForeground()); checkbox.setEnabled(isEnabled()); checkbox.setFont(getFont()); checkbox.setFocusPainted(false); checkbox.setBorderPainted(true); checkbox.setBorder(isSelected ? UIManager.getBorder("List.focusCellHighlightBorder") : noFocusBorder); return checkbox; }
Example 7
Source File: hover_press_utilclass.java From java-QQ- with Apache License 2.0 | 5 votes |
public static JCheckBox getIconCheckBox(String iconPath, String pressIconPath, String rolloverIconPath,String selectedIconPath) { JCheckBox checkBox = new JCheckBox(); checkBox.setIcon(new ImageIcon(iconPath)); checkBox.setPressedIcon(new ImageIcon(pressIconPath)); checkBox.setRolloverIcon(new ImageIcon(rolloverIconPath)); checkBox.setSelectedIcon(new ImageIcon(selectedIconPath)); checkBox.setBorder(null); checkBox.setFocusPainted(false); checkBox.setContentAreaFilled(false); return checkBox; }