Example usage for javax.swing AbstractButton TEXT_CHANGED_PROPERTY

List of usage examples for javax.swing AbstractButton TEXT_CHANGED_PROPERTY

Introduction

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

Prototype

String TEXT_CHANGED_PROPERTY

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

Click Source Link

Document

Identifies a change in the button's text.

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 w  w.j a v a  2 s  . c o  m
    }
}