Example usage for javax.swing JCheckBox setRolloverIcon

List of usage examples for javax.swing JCheckBox setRolloverIcon

Introduction

In this page you can find the example usage for javax.swing JCheckBox setRolloverIcon.

Prototype

@BeanProperty(visualUpdate = true, description = "The rollover icon for the button.")
public void setRolloverIcon(Icon rolloverIcon) 

Source Link

Document

Sets the rollover icon for the button.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {

    JCheckBox checkbox = new JCheckBox();

    Icon rollIcon = new ImageIcon("roll-icon.gif");
    checkbox.setRolloverIcon(rollIcon);

}

From source file:Main.java

public Main() {
    // Add check boxes to the content pane.
    Icon normal = new MyIcon(Color.red);
    Icon rollover = new MyIcon(Color.YELLOW);
    Icon selected = new MyIcon(Color.BLUE);

    JCheckBox cb = new JCheckBox();
    cb.setRolloverIcon(rollover);
    cb.setSelectedIcon(selected);/*  ww  w . ja v a 2 s  .c om*/
    cb.addItemListener(this);
    add(cb);

}

From source file:Main.java

public Main() {
    // Add check boxes to the content pane.
    Icon normal = new MyIcon(Color.red);
    Icon rollover = new MyIcon(Color.YELLOW);
    Icon selected = new MyIcon(Color.BLUE);

    JCheckBox cb = new JCheckBox(normal);
    cb.setRolloverIcon(rollover);
    cb.setSelectedIcon(selected);//from  w  w  w.j ava 2 s  .com
    cb.addItemListener(this);
    add(cb);

}

From source file:Main.java

public Main() {
    // Add check boxes to the content pane.
    Icon normal = new MyIcon(Color.red);
    Icon rollover = new MyIcon(Color.YELLOW);
    Icon selected = new MyIcon(Color.BLUE);

    JCheckBox cb = new JCheckBox(normal, true);
    cb.setRolloverIcon(rollover);
    cb.setSelectedIcon(selected);/*from   w  w w.  j  a v a 2  s  .  co m*/
    cb.addItemListener(this);
    add(cb);

}

From source file:Main.java

public Main() {
    // Add check boxes to the content pane.
    Icon normal = new MyIcon(Color.red);
    Icon rollover = new MyIcon(Color.YELLOW);
    Icon selected = new MyIcon(Color.BLUE);

    JCheckBox cb = new JCheckBox("www.java2s.com", normal);
    cb.setRolloverIcon(rollover);
    cb.setSelectedIcon(selected);// w w  w .j  a  v a2 s.  c o  m
    cb.addItemListener(this);
    add(cb);

}

From source file:MainClass.java

public MainClass() {
    // Add check boxes to the content pane.
    Icon normal = new MyIcon(Color.red);
    Icon rollover = new MyIcon(Color.YELLOW);
    Icon selected = new MyIcon(Color.BLUE);

    JCheckBox cb = new JCheckBox("www.java2s.com", normal);
    cb.setRolloverIcon(rollover);
    cb.setSelectedIcon(selected);/*from   w ww  .j  a va2  s.  c o  m*/
    cb.addItemListener(this);
    add(cb);

}

From source file:Main.java

public Main() {
    // Add check boxes to the content pane.
    Icon normal = new MyIcon(Color.red);
    Icon rollover = new MyIcon(Color.YELLOW);
    Icon selected = new MyIcon(Color.BLUE);

    JCheckBox cb = new JCheckBox("www.java2s.com", normal, true);
    cb.setRolloverIcon(rollover);
    cb.setSelectedIcon(selected);/*from   www  .  j a va 2 s . c  o m*/
    cb.addItemListener(this);
    add(cb);

}

From source file:JCheckBoxCustomIcon.java

public JCheckBoxCustomIcon() {
    setSize(300, 300);//from w ww  .  j  av a2 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:Main.java

public Main() {
    setSize(300, 300);//from w w  w  .j  a v  a2  s  .  c  om
    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);
}