List of usage examples for javax.swing JCheckBox setSelectedIcon
@BeanProperty(visualUpdate = true, description = "The selected icon for the button.") public void setSelectedIcon(Icon selectedIcon)
From source file:Main.java
public Main() { setSize(300, 300);/* ww w. ja va 2 s.com*/ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new FlowLayout(FlowLayout.LEFT)); JCheckBox checkBox = new JCheckBox("Check me!"); checkBox.setSelected(true); // Set default icon for checkbox checkBox.setIcon(new ImageIcon("icon.png")); // Set selected icon when checkbox state is selected checkBox.setSelectedIcon(new ImageIcon("selectedIcon.png")); // Set disabled icon for checkbox checkBox.setDisabledIcon(new ImageIcon("disabledIcon.png")); // Set disabled-selected icon for checkbox checkBox.setDisabledSelectedIcon(new ImageIcon("disabledSelectedIcon.png")); // Set checkbox icon when checkbox is pressed checkBox.setPressedIcon(new ImageIcon("pressedIcon.png")); // Set icon when a mouse is over the checkbox checkBox.setRolloverIcon(new ImageIcon("rolloverIcon.png")); // Set icon when a mouse is over a selected checkbox checkBox.setRolloverSelectedIcon(new ImageIcon("rolloverSelectedIcon.png")); getContentPane().add(checkBox); }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JCheckBox getIntelCheckBox(String text) { JCheckBox box = new JCheckBox(text); box.setIcon(UIImages.EMPTY_BOX_ICON.getImageIcon()); box.setSelectedIcon(UIImages.CHECK_BOX_ICON.getImageIcon()); box.setBackground(Color.WHITE); return box;/*w ww . j a va2s .co m*/ }