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

The following examples show how to use javax.swing.JCheckBox#setSelectedIcon() . 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: CollapsiblePanel.java    From littleluck with Apache License 2.0 6 votes vote down vote up
protected Component createCollapseControl(String title, String tooltip) {
    // Add upper panel to hold collapse control
    Box box = Box.createHorizontalBox();
    expandCheckBox = new JCheckBox(title);
    expandCheckBox.setOpaque(false);
    expandCheckBox.setBorder(new EmptyBorder(0,4,0,0));
    expandCheckBox.setToolTipText(tooltip);
    expandCheckBox.setHorizontalTextPosition(JCheckBox.RIGHT);
    expandCheckBox.setSelectedIcon(new ArrowIcon(ArrowIcon.SOUTH));
    expandCheckBox.setIcon(new ArrowIcon(ArrowIcon.EAST));
    expandCheckBox.setSelected(isExpanded());
    
    expandCheckBox.addChangeListener(new CollapseListener());
    box.add(expandCheckBox);
    
    return box;                       
}
 
Example 2
Source File: CollapsiblePanel.java    From beautyeye with Apache License 2.0 6 votes vote down vote up
protected Component createCollapseControl(String title, String tooltip) {
    // Add upper panel to hold collapse control
    Box box = Box.createHorizontalBox();
    
    expandCheckBox = new JCheckBox(title);
    expandCheckBox.setBorder(new EmptyBorder(0,4,0,0));
    expandCheckBox.setToolTipText(tooltip);
    expandCheckBox.setHorizontalTextPosition(JCheckBox.RIGHT);
    expandCheckBox.setSelectedIcon(new ArrowIcon(ArrowIcon.SOUTH));
    expandCheckBox.setIcon(new ArrowIcon(ArrowIcon.EAST));
    expandCheckBox.setSelected(isExpanded());
    
    expandCheckBox.addChangeListener(new CollapseListener());
    box.add(expandCheckBox);
    
    return box;                       
}
 
Example 3
Source File: SettingsPage.java    From xdm with GNU General Public License v2.0 5 votes vote down vote up
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 4
Source File: ImageGallery.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 5 votes vote down vote up
/**
 * create returns the thumb close component
 *
 * @param p
 * @return
 */
private JComponent setupThumbClose(final JPanel p) {
    JCheckBox cb = new JCheckBox();
    cb.setIcon(close);
    cb.setSelectedIcon(closesel);
    cb.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            removeThumbPanel(p);
        }
    });
    cb.setPreferredSize(CL_SIZE);
    cb.setMaximumSize(CL_SIZE);
    return cb;
}
 
Example 5
Source File: JCheckBoxTree.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 5 votes vote down vote up
public CheckBoxCellRenderer() {
    super();
    this.setLayout(new BorderLayout());
    checkBox = new JCheckBox();
    checkBox.setSelectedIcon(selectedIcon);
    add(checkBox, BorderLayout.CENTER);
    setOpaque(false);
}
 
Example 6
Source File: hover_press_utilclass.java    From java-QQ- with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 7
Source File: StyledCheckBoxUI.java    From stendhal with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void installUI(JComponent component) {
	super.installUI(component);
	component.setForeground(style.getForeground());
	component.setOpaque(false);
	component.setFont(style.getFont().deriveFont(Font.BOLD));

	if (component instanceof JCheckBox) {
		JCheckBox checkBox = (JCheckBox) component;
		checkBox.setIcon(defaultIcon);
		checkBox.setSelectedIcon(defaultSelectedIcon);
		checkBox.setDisabledIcon(disabledIcon);
		checkBox.setDisabledSelectedIcon(disabledSelectedIcon);
	}
}
 
Example 8
Source File: PrivacyAddDialogUI.java    From Spark with Apache License 2.0 5 votes vote down vote up
private JPanel createCheckBoxes() {
    JPanel panel = new JPanel();
    panel.setLayout(new GridBagLayout());
    panel.setBorder(BorderFactory.createTitledBorder(Res.getString("privacy.border.block")));
    _blockPIn = new JCheckBox(Res.getString("privacy.label.pin.desc"));
    _blockPIn.setIcon(SparkRes.getImageIcon("PRIVACY_PIN_ALLOW"));
    _blockPIn.setSelectedIcon(SparkRes.getImageIcon("PRIVACY_PIN_DENY"));
    _blockPIn.setRolloverEnabled(false);
    _blockPOout = new JCheckBox(Res.getString("privacy.label.pout.desc"));
    _blockPOout.setIcon(SparkRes.getImageIcon("PRIVACY_POUT_ALLOW"));
    _blockPOout.setSelectedIcon(SparkRes.getImageIcon("PRIVACY_POUT_DENY"));
    _blockPOout.setRolloverEnabled(false);
    _blockMsg = new JCheckBox(Res.getString("privacy.label.msg.desc"));
    _blockMsg.setSelectedIcon(SparkRes.getImageIcon("PRIVACY_MSG_DENY"));
    _blockMsg.setIcon(SparkRes.getImageIcon("PRIVACY_MSG_ALLOW"));
    _blockMsg.setRolloverEnabled(false);
    _blockIQ = new JCheckBox(Res.getString("privacy.label.iq.desc"));
    _blockIQ.setSelectedIcon(SparkRes.getImageIcon("PRIVACY_QUERY_DENY"));
    _blockIQ.setIcon(SparkRes.getImageIcon("PRIVACY_QUERY_ALLOW"));
    _blockIQ.setRolloverEnabled(false);
    panel.add(_blockPIn, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    panel.add(_blockPOout, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    panel.add(_blockMsg, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    panel.add(_blockIQ, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

    return panel;
}
 
Example 9
Source File: VideoItemEditor.java    From xdm with GNU General Public License v2.0 4 votes vote down vote up
public VideoItemEditor(MediaImageSource imgSource) {
	component = new JPanel(new BorderLayout(getScaledInt(5), getScaledInt(5)));
	component.setBorder(new EmptyBorder(0, getScaledInt(5), getScaledInt(5), getScaledInt(5)));
	panel = new JPanel(new BorderLayout());
	lbl = new JLabel();
	lbl.setVerticalAlignment(JLabel.CENTER);
	lbl.setVerticalTextPosition(JLabel.CENTER);
	lbl.setFont(FontResource.getBigFont());
	lblIcon = new JLabel();
	lblIcon.setOpaque(true);
	lblIcon.setMinimumSize(new Dimension(getScaledInt(119), getScaledInt(92)));
	lblIcon.setMaximumSize(new Dimension(getScaledInt(119), getScaledInt(92)));
	lblIcon.setPreferredSize(new Dimension(getScaledInt(119), getScaledInt(92)));
	lblIcon.setHorizontalAlignment(JLabel.CENTER);
	ico = ImageResource.getIcon("videoplay.png",94,92);
	lblIcon.setIcon(ico);
	// lblIcon.setBorder(new EmptyBorder(12, 5, 5, 5));
	lblIcon.setVerticalAlignment(JLabel.CENTER);
	// lblIcon.setPreferredSize(new Dimension(53, 53));

	JPanel p1 = new JPanel(new BorderLayout());
	p1.setOpaque(false);
	p1.add(lblIcon);
	chk = new JCheckBox("");
	chk.setOpaque(false);
	chk.setIcon(ImageResource.getIcon("unchecked.png",16,16));
	chk.setSelectedIcon(ImageResource.getIcon("checked.png",16,16));
	p1.add(chk, BorderLayout.WEST);
	p1.setBorder(new EmptyBorder(getScaledInt(12), 0, getScaledInt(5), getScaledInt(5)));
	component.add(p1, BorderLayout.WEST);
	cmbModel = new DefaultComboBoxModel<>();
	cmb = new JComboBox<>(cmbModel);
	cmb.setPreferredSize(new Dimension(getScaledInt(200), getScaledInt(30)));
	cmb.setOpaque(false);
	cmb.setBorder(null);
	panel.add(lbl);
	panel.add(cmb, BorderLayout.SOUTH);
	panel.setOpaque(false);
	panel.setBorder(new EmptyBorder(0, 0, getScaledInt(5), getScaledInt(5)));
	component.add(panel);
	lblBorder = new JLabel();
	lblBorder.setPreferredSize(new Dimension(getScaledInt(100), 1));
	lblBorder.setMaximumSize(new Dimension(getScaledInt(100), 1));
	lblBorder.setBackground(ColorResource.getDarkerBgColor());
	component.add(lblBorder, BorderLayout.NORTH);
	component.setOpaque(false);
	this.imgSource = imgSource;
	// component.setBackground(ColorResource.getSelectionColor());
}