Example usage for java.awt.event ActionListener getClass

List of usage examples for java.awt.event ActionListener getClass

Introduction

In this page you can find the example usage for java.awt.event ActionListener getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:net.pandoragames.far.ui.swing.component.MacOSXMenuAdapter.java

/**
 * Adds an ActionListener for the specified command.
 * @param listener to be executed on the indicated command.
 * @param cmd the command to trigger the action. 
 */// w  w  w  .  j  a v a  2 s . com
public void registerEventHandler(ActionListener listener, OSXCOMMAND cmd) {
    if (listener == null)
        throw new NullPointerException("ActionListener must not be null");
    if (cmd == null)
        throw new NullPointerException("Command parameter must not be null");
    if (listenerMap.containsKey(cmd.name())) {
        listenerMap.get(cmd.name()).add(listener);
    } else {
        List<ActionListener> list = new ArrayList<ActionListener>();
        list.add(listener);
        listenerMap.put(cmd.name(), list);
    }
    switch (cmd) {
    case About:
        enableApplicationMenuItem("setEnabledAboutMenu");
        break;
    case Preferences:
        enableApplicationMenuItem("setEnabledPreferencesMenu");
        break;
    case OpenFile:
        /* not implemented */ break;
    }
    logger.info("Registered " + listener.getClass().getName() + " for command " + cmd.name().toUpperCase());
}