Example usage for javax.swing Action equals

List of usage examples for javax.swing Action equals

Introduction

In this page you can find the example usage for javax.swing Action equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:Main.java

/**
 * Finds a {@link JMenu} for the given {@link Action} within the given
 * menu.//  ww  w . ja v a 2 s .  c  o m
 *
 * @param menu
 * @param action
 * @return
 */
public static JMenu findMenu(JMenu menu, Action action) {
    if (action.equals(menu.getAction())) {
        return menu;
    }
    for (Component comp : menu.getMenuComponents()) {
        if (comp instanceof JMenu) {
            if (((JMenu) comp).getAction().equals(action)) {
                return (JMenu) comp;
            }
            return findMenu((JMenu) comp, action);
        }
    }
    return null;
}