Example usage for javax.swing AbstractButton ICON_CHANGED_PROPERTY

List of usage examples for javax.swing AbstractButton ICON_CHANGED_PROPERTY

Introduction

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

Prototype

String ICON_CHANGED_PROPERTY

To view the source code for javax.swing AbstractButton ICON_CHANGED_PROPERTY.

Click Source Link

Document

Identifies a change to the icon that represents the button.

Usage

From source file:AbstractButtonPropertyChangeListener.java

License:asdf

public void propertyChange(PropertyChangeEvent e) {
    String propertyName = e.getPropertyName();
    System.out.println("Property Name: " + propertyName);
    if (e.getPropertyName().equals(AbstractButton.TEXT_CHANGED_PROPERTY)) {
        String newText = (String) e.getNewValue();
        String oldText = (String) e.getOldValue();
        System.out.println(oldText + " changed to " + newText);
    } else if (e.getPropertyName().equals(AbstractButton.ICON_CHANGED_PROPERTY)) {
        Icon icon = (Icon) e.getNewValue();
        if (icon instanceof ImageIcon) {
            System.out.println("New icon is an image");
        }/*from  w  ww  .jav  a  2 s . com*/
    }
}