Example usage for javax.swing AbstractButton setSelectedIcon

List of usage examples for javax.swing AbstractButton setSelectedIcon

Introduction

In this page you can find the example usage for javax.swing AbstractButton setSelectedIcon.

Prototype

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

Source Link

Document

Sets the selected icon for the button.

Usage

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JToggleButton("Press Me");
    jb.setSelectedIcon(new MyIcon());

    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);/*from ww w  . j  ava2s  .  com*/
    f.pack();
    f.setVisible(true);
}