Example usage for javax.swing JToggleButton setRolloverSelectedIcon

List of usage examples for javax.swing JToggleButton setRolloverSelectedIcon

Introduction

In this page you can find the example usage for javax.swing JToggleButton setRolloverSelectedIcon.

Prototype

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

Source Link

Document

Sets the rollover selected icon for the button.

Usage

From source file:org.revager.tools.GUITools.java

/**
 * Creates a new image toggle button./*from  w w w . j  a v a  2  s .  c o  m*/
 * 
 * @param icon
 *            the normal icon
 * @param rolloverIcon
 *            the rollover icon
 * @param action
 *            the action
 * 
 * @return the newly created image button
 */
public static JToggleButton newImageToggleButton(ImageIcon icon, ImageIcon rolloverIcon, Action action) {
    JToggleButton button = new JToggleButton(action);
    button.setToolTipText(button.getText());
    button.setText(null);
    button.setContentAreaFilled(false);
    button.setBorder(new EmptyBorder(0, 0, 0, 0));
    button.setMargin(new Insets(0, 0, 0, 0));
    button.setBorderPainted(false);
    button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    button.setFocusPainted(false);
    button.setFocusable(false);

    button.setIcon(icon);
    button.setRolloverIcon(rolloverIcon);
    button.setRolloverSelectedIcon(rolloverIcon);
    button.setSelectedIcon(rolloverIcon);

    return button;
}