List of usage examples for javax.swing JComponent setActionMap
public final void setActionMap(ActionMap am)
ActionMap
to am
. From source file:Main.java
public static ActionMap installActionMap(JComponent c, ActionMap map) { if (map == null) { return null; }/*w w w .j a v a 2s . co m*/ ActionMap currentMap = c.getActionMap(); if (currentMap != null) { ActionMap parent = currentMap; while (parent.getParent() != null) { if (parent == map) { return map; } parent = parent.getParent(); } parent.setParent(map); } else { c.setActionMap(map); } return map; }
From source file:Main.java
public static void uninstallActionMap(JComponent c, ActionMap map) { if (map == null) { return;// w w w. j a v a 2s .c o m } ActionMap firstMap = c.getActionMap(); ActionMap parent = firstMap; ActionMap child = null; ActionMap newMap = null; while (parent != null) { if (parent == map) { if (child != null) { child.setParent(parent.getParent()); child = parent; } else { newMap = parent.getParent(); } } else { child = parent; } parent = parent.getParent(); } if (newMap != null) { c.setActionMap(newMap); } }
From source file:pcgen.gui2.PCGenFrame.java
private void initComponents() { setLayout(new BorderLayout()); JComponent root = getRootPane(); root.setActionMap(actionMap); root.setInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, createInputMap(actionMap)); characterTabs.add(new InfoGuidePane(this, uiContext)); setJMenuBar(new PCGenMenuBar(this, uiContext)); add(new PCGenToolBar(this), BorderLayout.NORTH); add(characterTabs, BorderLayout.CENTER); add(statusBar, BorderLayout.SOUTH); updateTitle();//from ww w. j a va2 s . co m setIconImage(Icons.PCGenApp.getImageIcon().getImage()); }