List of usage examples for javax.swing JMenu getAction
public Action getAction()
Action
for this ActionEvent
source, or null
if no Action
is set. From source file:Main.java
/** * Finds a {@link JMenu} for the given {@link Action} within the given * menu./*from w w w. j a 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; }