Example usage for javax.swing JMenuItem addPropertyChangeListener

List of usage examples for javax.swing JMenuItem addPropertyChangeListener

Introduction

In this page you can find the example usage for javax.swing JMenuItem addPropertyChangeListener.

Prototype

public void addPropertyChangeListener(PropertyChangeListener listener) 

Source Link

Document

Adds a PropertyChangeListener to the listener list.

Usage

From source file:Main.java

/**
 * Forces slave menu item to reflect master menu item using a property change
 * listener./* w  w  w  .jav  a 2s . c o  m*/
 */
protected static void linkMenuItem(final JMenuItem master, final JMenuItem slave) {
    final JMenuItem source = master, dest = slave;
    source.addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent e) {
            syncMenuItem(source, dest);
        }
    });
}