java.awt.event.HierarchyBoundsListener#javax.swing.ActionMap源码实例Demo

下面列出了java.awt.event.HierarchyBoundsListener#javax.swing.ActionMap 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: netbeans   文件: AddModulePanel.java
private static void exchangeCommands(String[][] commandsToExchange,
        final JComponent target, final JComponent source) {
    InputMap targetBindings = target.getInputMap();
    KeyStroke[] targetBindingKeys = targetBindings.allKeys();
    ActionMap targetActions = target.getActionMap();
    InputMap sourceBindings = source.getInputMap();
    ActionMap sourceActions = source.getActionMap();
    for (int i = 0; i < commandsToExchange.length; i++) {
        String commandFrom = commandsToExchange[i][0];
        String commandTo = commandsToExchange[i][1];
        final Action orig = targetActions.get(commandTo);
        if (orig == null) {
            continue;
        }
        sourceActions.put(commandTo, new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
                orig.actionPerformed(new ActionEvent(target, e.getID(), e.getActionCommand(), e.getWhen(), e.getModifiers()));
            }
        });
        for (int j = 0; j < targetBindingKeys.length; j++) {
            if (targetBindings.get(targetBindingKeys[j]).equals(commandFrom)) {
                sourceBindings.put(targetBindingKeys[j], commandTo);
            }
        }
    }
}
 
源代码2 项目: netbeans   文件: Outline.java
private void init() {
    initialized = true;
    setDefaultRenderer(Object.class, new DefaultOutlineCellRenderer());
    ActionMap am = getActionMap();
    //make rows expandable with left/rigt arrow keys
    Action a = am.get("selectNextColumn"); //NOI18N
    am.put("selectNextColumn", new ExpandAction(true, a)); //NOI18N
    a = am.get("selectPreviousColumn"); //NOI18N
    am.put("selectPreviousColumn", new ExpandAction(false, a)); //NOI18N
    getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (getSelectedRowCount() == 1) {
                selectedRow = getSelectedRow();
            } else {
                selectedRow = -1;
            }
        }
    });
}
 
源代码3 项目: visualvm   文件: SearchUtils.java
public KeyStroke registerAction(String actionKey, Action action, ActionMap actionMap, InputMap inputMap) {
    KeyStroke ks = null;
    
    if (FIND_ACTION_KEY.equals(actionKey)) {
        ks = KeyStroke.getKeyStroke(KeyEvent.VK_G, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
    } else if (FIND_NEXT_ACTION_KEY.equals(actionKey)) {
        ks = KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0);
    } else if (FIND_PREV_ACTION_KEY.equals(actionKey)) {
        ks = KeyStroke.getKeyStroke(KeyEvent.VK_F3, InputEvent.SHIFT_MASK);
    } else if (FIND_SEL_ACTION_KEY.equals(actionKey)) {
        ks = KeyStroke.getKeyStroke(KeyEvent.VK_F3, InputEvent.CTRL_MASK);
    }
    
    if (ks != null) {
        actionMap.put(actionKey, action);
        inputMap.put(ks, actionKey);
    }

    return ks;
}
 
源代码4 项目: netbeans   文件: QueryBuilder.java
/** Opened for the first time */
   @Override
   protected void componentOpened() {

Log.getLogger().entering("QueryBuilder", "componentOpened");

       activateActions();
       ActionMap map = getActionMap();
       InputMap keys = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
       installActions(map, keys);
       
       // QueryBuilder does not need to listen to VSE, because it will notify us
       // directly if something changes. The SqlCommandCustomizer needs to listen 
       // to VSE, because that's the only way it is notified of changes to the command 
       // sqlStatement.addPropertyChangeListener(sqlStatementListener) ;
       // vse.addPropertyChangeListener(sqlStatementListener) ;

       // do NOT force a parse here.  It's done in componentShowing().
       // populate( sqlStatement.getCommand()) ;
   }
 
源代码5 项目: portmapper   文件: PortMapperView.java
private JComponent getPresetPanel() {
    final ActionMap actionMap = this.getContext().getActionMap(this.getClass(), this);

    final JPanel presetPanel = new JPanel(new MigLayout("", "[grow, fill][]", ""));
    presetPanel.setBorder(BorderFactory
            .createTitledBorder(app.getResourceMap().getString("mainFrame.port_mapping_presets.title")));

    portMappingPresets = new JList<>(new PresetListModel(app.getSettings()));
    portMappingPresets.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    portMappingPresets.setLayoutOrientation(JList.VERTICAL);

    portMappingPresets.addListSelectionListener(e -> {
        logger.trace("Selection of preset list has changed: {}", isPresetMappingSelected());
        firePropertyChange(PROPERTY_PRESET_MAPPING_SELECTED, false, isPresetMappingSelected());
    });

    presetPanel.add(new JScrollPane(portMappingPresets), "spany 4, grow");

    presetPanel.add(new JButton(actionMap.get(ACTION_CREATE_PRESET_MAPPING)), "wrap, sizegroup preset_buttons");
    presetPanel.add(new JButton(actionMap.get(ACTION_EDIT_PRESET_MAPPING)), "wrap, sizegroup preset_buttons");
    presetPanel.add(new JButton(actionMap.get(ACTION_REMOVE_PRESET_MAPPING)), "wrap, sizegroup preset_buttons");
    presetPanel.add(new JButton(actionMap.get(ACTION_USE_PRESET_MAPPING)), "wrap, sizegroup preset_buttons");

    return presetPanel;
}
 
源代码6 项目: netbeans   文件: SearchUtils.java
public KeyStroke registerAction(String actionKey, Action action, ActionMap actionMap, InputMap inputMap) {
    KeyStroke ks = null;
    
    if (FIND_ACTION_KEY.equals(actionKey)) {
        ks = KeyStroke.getKeyStroke(KeyEvent.VK_G, InputEvent.CTRL_MASK);
    } else if (FIND_NEXT_ACTION_KEY.equals(actionKey)) {
        ks = KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0);
    } else if (FIND_PREV_ACTION_KEY.equals(actionKey)) {
        ks = KeyStroke.getKeyStroke(KeyEvent.VK_F3, InputEvent.SHIFT_MASK);
    } else if (FIND_SEL_ACTION_KEY.equals(actionKey)) {
        ks = KeyStroke.getKeyStroke(KeyEvent.VK_F3, InputEvent.CTRL_MASK);
    }
    
    if (ks != null) {
        actionMap.put(actionKey, action);
        inputMap.put(ks, actionKey);
    }

    return ks;
}
 
源代码7 项目: diirt   文件: CompareResultImages.java
/**
 * Creates new form CompareResultImages
 */
public CompareResultImages() {
    initComponents();
    toReviewList.setModel(new DefaultListModel());
    fillList();
    setSize(800, 600);
    setExtendedState(getExtendedState() | MAXIMIZED_BOTH);
    actualImage.setStretch(false);
    referenceImage.setStretch(false);
    acceptAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control D"));

    InputMap keyMap = new ComponentInputMap(acceptButton);
    keyMap.put(KeyStroke.getKeyStroke("control D"), "accept");

    ActionMap actionMap = new ActionMapUIResource();
    actionMap.put("accept", acceptAction);

    SwingUtilities.replaceUIActionMap(acceptButton, actionMap);
    SwingUtilities.replaceUIInputMap(acceptButton, JComponent.WHEN_IN_FOCUSED_WINDOW, keyMap);
}
 
源代码8 项目: netbeans   文件: TemplatesPanel.java
/** Creates new form TemplatesPanel */
public TemplatesPanel (String pathToSelect) {
    
    ActionMap map = getActionMap ();
    map.put (DefaultEditorKit.copyAction, ExplorerUtils.actionCopy (getExplorerManager ()));
    map.put (DefaultEditorKit.cutAction, ExplorerUtils.actionCut (getExplorerManager ()));
    map.put (DefaultEditorKit.pasteAction, ExplorerUtils.actionPaste (getExplorerManager ()));
    map.put ("delete", ExplorerUtils.actionDelete (getExplorerManager (), true)); // NOI18N
    
    initComponents ();
    createTemplateView ();
    treePanel.add (view, BorderLayout.CENTER);
    
    associateLookup (ExplorerUtils.createLookup (getExplorerManager (), map));
    initialize (pathToSelect);
    
}
 
源代码9 项目: netbeans   文件: ErrorNavigatorProviderImpl.java
public JComponent getComponent() {
    if (panel == null) {
        final BeanTreeView view = new BeanTreeView();
        view.setRootVisible(false);
        view.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        class Panel extends JPanel implements ExplorerManager.Provider, Lookup.Provider {
            // Make sure action context works correctly:
            private final Lookup lookup = ExplorerUtils.createLookup(manager, new ActionMap());
            {
                setLayout(new BorderLayout());
                add(view, BorderLayout.CENTER);
            }
            public ExplorerManager getExplorerManager() {
                return manager;
            }
            public Lookup getLookup() {
                return lookup;
            }
        }
        panel = new Panel();
    }
    return panel;
}
 
源代码10 项目: netbeans   文件: PasteAction.java
/** Finds appropriate map to work with.
 * @return map from lookup or from activated TopComponent, null no available
 */
private ActionMap map() {
    if (result == null) {
        TopComponent tc = TopComponent.getRegistry().getActivated();

        if (tc != null) {
            return tc.getActionMap();
        }
    } else {
        for (ActionMap am : result.allInstances()) {
            return am;
        }
    }

    return null;
}
 
源代码11 项目: netbeans   文件: ClasspathNavigatorProviderImpl.java
public JComponent getComponent() {
    if (panel == null) {
        final PropertySheetView view = new PropertySheetView();
        class Panel extends JPanel implements ExplorerManager.Provider, Lookup.Provider {
            // Make sure action context works correctly:
            private final Lookup lookup = ExplorerUtils.createLookup(manager, new ActionMap());
            {
                setLayout(new BorderLayout());
                add(view, BorderLayout.CENTER);
            }
            public ExplorerManager getExplorerManager() {
                return manager;
            }
            public Lookup getLookup() {
                return lookup;
            }
        }
        panel = new Panel();
    }
    return panel;
}
 
源代码12 项目: binnavi   文件: CGraphSearchField.java
/**
 * Registers all hotkeys processed by the graph search field.
 */
private void registerHotkeys() {
  final ActionMap actionMap = ((JTextField) getEditor().getEditorComponent()).getActionMap();
  final InputMap imap = ((JTextField) getEditor().getEditorComponent()).getInputMap();
  setActionMap(actionMap);
  setInputMap(JComponent.WHEN_FOCUSED, imap);

  imap.put(HotKeys.GRAPH_SEARCH_NEXT_KEY.getKeyStroke(), "NEXT");
  imap.put(HotKeys.GRAPH_SEARCH_NEXT_ZOOM_KEY.getKeyStroke(), "NEXT_ZOOM");
  imap.put(HotKeys.GRAPH_SEARCH_PREVIOUS_KEY.getKeyStroke(), "PREVIOUS");
  imap.put(HotKeys.GRAPH_SEARCH_PREVIOUS_ZOOM_KEY.getKeyStroke(), "PREVIOUS_ZOOM");

  actionMap.put("NEXT", CActionProxy.proxy(new CActionHotKey("NEXT")));
  actionMap.put("NEXT_ZOOM", CActionProxy.proxy(new CActionHotKey("NEXT_ZOOM")));
  actionMap.put("PREVIOUS", CActionProxy.proxy(new CActionHotKey("PREVIOUS")));
  actionMap.put("PREVIOUS_ZOOM", CActionProxy.proxy(new CActionHotKey("PREVIOUS_ZOOM")));
}
 
源代码13 项目: netbeans   文件: MultiViewActionMapTest.java
public void testSimplifiedActionMapChanges81117() {
    MultiViewTopComponentLookup.InitialProxyLookup lookup = new MultiViewTopComponentLookup.InitialProxyLookup(new ActionMap());
    Lookup.Result res = lookup.lookup(new Lookup.Template(ActionMap.class));
    LookListener list = new LookListener();
    list.resetCount();
    res.addLookupListener(list);
    assertEquals(1, res.allInstances().size());
    assertEquals(0, list.getCount());
    lookup.refreshLookup();
    assertEquals(1, list.getCount());
    assertEquals(1, res.allInstances().size());
    
    MultiViewTopComponentLookup lookup2 = new MultiViewTopComponentLookup(new ActionMap());
    res = lookup2.lookup(new Lookup.Template(ActionMap.class));
    list = new LookListener();
    list.resetCount();
    res.addLookupListener(list);
    assertEquals(1, res.allInstances().size());
    assertEquals(0, list.getCount());
    lookup2.setElementLookup(Lookups.fixed(new Object[] {new Object()} ));
    assertEquals(1, list.getCount());
    assertEquals(1, res.allInstances().size());
    
}
 
源代码14 项目: netbeans   文件: CallbackSystemAction.java
/*** Finds an action that we should delegate to
 * @return the action or null
 */
private Action findAction() {
    Collection<? extends ActionMap> c = result != null ? result.allInstances() : Collections.<ActionMap>emptySet();

    if (!c.isEmpty()) {
        Object key = delegate.getActionMapKey();
        for (ActionMap map : c) {
            Action action = map.get(key);
            if (action != null) {
                return action;
            }
        }
    }

    return null;
}
 
源代码15 项目: netbeans   文件: NodeOperationImpl.java
public ExplorerPanel(Node n) {
    manager = new ExplorerManager();
    manager.setRootContext(n);
    ActionMap map = getActionMap();
    map.put(DefaultEditorKit.copyAction, ExplorerUtils.actionCopy(manager));
    map.put(DefaultEditorKit.cutAction, ExplorerUtils.actionCut(manager));
    map.put(DefaultEditorKit.pasteAction, ExplorerUtils.actionPaste(manager));
    map.put("delete", ExplorerUtils.actionDelete(manager, true));
    associateLookup(ExplorerUtils.createLookup (manager, map));
    setLayout(new BorderLayout());
    add(new BeanTreeView());
    setName(n.getDisplayName());
}
 
源代码16 项目: portmapper   文件: PortMapperView.java
private JComponent getMappingsPanel() {
    // Mappings panel

    final ActionMap actionMap = this.getContext().getActionMap(this.getClass(), this);

    tableModel = new PortMappingsTableModel(app);
    mappingsTable = new JTable(tableModel);
    mappingsTable.setAutoCreateRowSorter(true);
    mappingsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    mappingsTable.setSize(new Dimension(400, 100));
    mappingsTable.getSelectionModel().addListSelectionListener(
            e -> firePropertyChange(PROPERTY_MAPPING_SELECTED, false, isMappingSelected()));

    final JScrollPane mappingsTabelPane = new JScrollPane();
    mappingsTabelPane.setViewportView(mappingsTable);

    final JPanel mappingsPanel = new JPanel(new MigLayout("", "[fill,grow]", "[grow,fill][]"));
    mappingsPanel.setName("port_mappings");
    final Border panelBorder = BorderFactory
            .createTitledBorder(app.getResourceMap().getString("mainFrame.port_mappings.title"));
    mappingsPanel.setBorder(panelBorder);
    mappingsPanel.add(mappingsTabelPane, "height 100::, span 2, wrap");

    mappingsPanel.add(new JButton(actionMap.get(ACTION_REMOVE_MAPPINGS)), "");
    mappingsPanel.add(new JButton(actionMap.get(ACTION_UPDATE_PORT_MAPPINGS)), "wrap");
    return mappingsPanel;
}
 
源代码17 项目: jclic   文件: Actions.java
/**
 * This function is for debug purposes only. Prints out the
 *
 * @param actionKeys
 * @param am
 */
public static void dumpActionKeys(Map<String, Object[]> actionKeys, ActionMap am) {
  for (String key : actionKeys.keySet()) {
    System.out.println(key + ":");
    for (Object val : (Object[]) actionKeys.get(key))
      System.out.println(" - " + val + " >> " + am.get(val));
  }
}
 
源代码18 项目: netbeans   文件: GlobalActionContextImpl.java
static void blickActionMapImpl(ActionMap map, Component[] focus) {
    assert EventQueue.isDispatchThread();
    Object obj = Lookup.getDefault ().lookup (ContextGlobalProvider.class);
    if (obj instanceof GlobalActionContextImpl) {
        GlobalActionContextImpl g = (GlobalActionContextImpl)obj;
        
        Lookup[] arr = {
            map == null ? Lookup.EMPTY : Lookups.singleton (map),
            Lookups.exclude (g.getLookup (), new Class[] { javax.swing.ActionMap.class }),
        };
        
        Lookup originalLkp = g.getLookup();
        Lookup prev = temporary;
        try {
            temporary = new ProxyLookup (arr);
            Lookup actionsGlobalContext = Utilities.actionsGlobalContext();
            Object q = actionsGlobalContext.lookup (javax.swing.ActionMap.class);
            assert q == map : dumpActionMapInfo(map, q, prev, temporary, actionsGlobalContext, originalLkp);
            if (focus != null) {
                setFocusOwner(focus[0]);
            }
        } finally {
            temporary = prev;
            // fire the changes about return of the values back
            org.openide.util.Utilities.actionsGlobalContext ().lookup (javax.swing.ActionMap.class);
        }
    }
}
 
源代码19 项目: netbeans   文件: ExplorerPanel.java
public ExplorerPanel() {
    manager = new ExplorerManager();
    ActionMap map = getActionMap();
    map.put(DefaultEditorKit.copyAction, ExplorerUtils.actionCopy(manager));
    map.put(DefaultEditorKit.cutAction, ExplorerUtils.actionCut(manager));
    map.put(DefaultEditorKit.pasteAction, ExplorerUtils.actionPaste(manager));
    map.put("delete", ExplorerUtils.actionDelete(manager, true));
}
 
源代码20 项目: PacketProxy   文件: GUIMain.java
private void addShortcutForWindows() {
	if (PacketProxyUtility.getInstance().isMac()) {
		return;
	}
	JPanel p = (JPanel) getContentPane();
	InputMap im = p.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
	ActionMap am = p.getActionMap();
	int hotkey = (KeyEvent.CTRL_MASK);
	registerTabShortcut(KeyEvent.VK_H, hotkey, im, am, Panes.HISTORY.ordinal());
	registerTabShortcut(KeyEvent.VK_I, hotkey, im, am, Panes.INTERCEPT.ordinal());
	registerTabShortcut(KeyEvent.VK_R, hotkey, im, am, Panes.REPEATER.ordinal());
	registerTabShortcut(KeyEvent.VK_B, hotkey, im, am, Panes.BULKSENDER.ordinal());
	registerTabShortcut(KeyEvent.VK_O, hotkey, im, am, Panes.OPTIONS.ordinal());
	registerTabShortcut(KeyEvent.VK_L, hotkey, im, am, Panes.LOG.ordinal());
}
 
源代码21 项目: netbeans   文件: ActionsSupport.java
public static KeyStroke registerAction(String actionKey, Action action, ActionMap actionMap, InputMap inputMap) {
    for (ActionsSupportProvider provider : Lookup.getDefault().lookupAll(ActionsSupportProvider.class)) {
        KeyStroke ks = provider.registerAction(actionKey, action, actionMap, inputMap);
        if (ks != null) return ks;
    }
    return null;
}
 
源代码22 项目: spotbugs   文件: MainFrameTree.java
ActionListener treeActionAdapter(ActionMap map, String actionName) {
    final Action selectPrevious = map.get(actionName);
    return e -> {
        e.setSource(tree);
        selectPrevious.actionPerformed(e);
    };
}
 
源代码23 项目: rapidminer-studio   文件: GlobalSearchAction.java
public GlobalSearchAction() {
	super(true, GLOBAL_SEARCH);
	InputMap inputMap = ApplicationFrame.getApplicationFrame().getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
	ActionMap actionMap = ApplicationFrame.getApplicationFrame().getRootPane().getActionMap();

	inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), GLOBAL_SEARCH);
	actionMap.put(GLOBAL_SEARCH, this);
}
 
源代码24 项目: netbeans   文件: CommitPanel.java
private void initActions () {
    InputMap inputMap = getInputMap( WHEN_ANCESTOR_OF_FOCUSED_COMPONENT );
    ActionMap actionMap = getActionMap();
    Object action = recentLabel.getClientProperty("openAction");
    if (action instanceof Action) {
        inputMap.put( KeyStroke.getKeyStroke( KeyEvent.VK_R, KeyEvent.ALT_DOWN_MASK, false ), "messageHistory" ); //NOI18N
        actionMap.put("messageHistory", (Action) action); //NOI18N
    }
    action = templatesLabel.getClientProperty("openAction");
    if (action instanceof Action) {
        inputMap.put( KeyStroke.getKeyStroke( KeyEvent.VK_L, KeyEvent.ALT_DOWN_MASK, false ), "messageTemplate" ); //NOI18N
        actionMap.put("messageTemplate", (Action) action); //NOI18N
    }
}
 
源代码25 项目: jdk8u60   文件: BasicLookAndFeel.java
/**
 * Sets the parent of the passed in ActionMap to be the audio action
 * map.
 */
static void installAudioActionMap(ActionMap map) {
    LookAndFeel laf = UIManager.getLookAndFeel();
    if (laf instanceof BasicLookAndFeel) {
        map.setParent(((BasicLookAndFeel)laf).getAudioActionMap());
    }
}
 
源代码26 项目: BART   文件: StatExecutionsTopComponent.java
public StatExecutionsTopComponent() {
    initComponents();
    setDisplayName(Bundle.CTL_StatExecutionsTopComponent());
    setName(ViewResource.TOP_NAME_StatExecutionsTopComponent);
    setToolTipText(Bundle.HINT_StatExecutionsTopComponent());
    setBackground(Color.WHITE);
    setLayout(new BorderLayout());
    add(new BeanTreeView(),BorderLayout.CENTER);
    ActionMap  map = this.getActionMap();
    map.put("delete", ExplorerUtils.actionDelete(exm, true));
    associateLookup(ExplorerUtils.createLookup(exm, this.getActionMap()));
}
 
源代码27 项目: jdk8u-jdk   文件: BasicLookAndFeel.java
/**
 * Helper method to play a named sound.
 *
 * @param c JComponent to play the sound for.
 * @param actionKey Key for the sound.
 */
static void playSound(JComponent c, Object actionKey) {
    LookAndFeel laf = UIManager.getLookAndFeel();
    if (laf instanceof BasicLookAndFeel) {
        ActionMap map = c.getActionMap();
        if (map != null) {
            Action audioAction = map.get(actionKey);
            if (audioAction != null) {
                // pass off firing the Action to a utility method
                ((BasicLookAndFeel)laf).playSound(audioAction);
            }
        }
    }
}
 
源代码28 项目: JDKSourceCode1.8   文件: BasicLookAndFeel.java
/**
 * Sets the parent of the passed in ActionMap to be the audio action
 * map.
 */
static void installAudioActionMap(ActionMap map) {
    LookAndFeel laf = UIManager.getLookAndFeel();
    if (laf instanceof BasicLookAndFeel) {
        map.setParent(((BasicLookAndFeel)laf).getAudioActionMap());
    }
}
 
源代码29 项目: binnavi   文件: CGraphHotkeys.java
/**
 * Register the default hotkeys of a graph view.
 * 
 * @param parent Parent window used for dialogs.
 * @param panel The panel where the view is shown.
 * @param debuggerProvider Provides the debugger used by some hotkeys.
 * @param searchField The search field that is shown in the graph panel.
 * @param addressField The address field that is shown in the graph panel.
 */
public static void registerHotKeys(final JFrame parent, final CGraphPanel panel,
    final IFrontEndDebuggerProvider debuggerProvider, final CGraphSearchField searchField,
    final CGotoAddressField addressField) {
  Preconditions.checkNotNull(parent, "IE01606: Parent argument can not be null");
  Preconditions.checkNotNull(panel, "IE01607: Panel argument can not be null");
  Preconditions.checkNotNull(searchField, "IE01608: Search field argument can not be null");
  Preconditions.checkNotNull(addressField, "IE01609: Address field argument can not be null");

  final InputMap inputMap = panel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
  final ActionMap actionMap = panel.getActionMap();

  inputMap.put(HotKeys.GRAPH_GOTO_ADDRESS_FIELD_KEY.getKeyStroke(), "GOTO_ADDRESS_FIELD");

  actionMap.put("GOTO_ADDRESS_FIELD", new AbstractAction() {
    /**
     * Used for serialization.
     */
    private static final long serialVersionUID = -8994014581850287793L;

    @Override
    public void actionPerformed(final ActionEvent event) {
      addressField.requestFocusInWindow();
    }
  });

  inputMap.put(HotKeys.GRAPH_SHOW_HOTKEYS_ACCELERATOR_KEY.getKeyStroke(), "SHOW_HOTKEYS");
  actionMap.put("SHOW_HOTKEYS", new CShowHotkeysAction(parent));

  registerSearchKeys(panel.getModel().getGraph().getView(), searchField, inputMap, actionMap);

  registerDebuggerKeys(panel.getModel().getParent(), panel.getModel().getGraph(),
      debuggerProvider, inputMap, actionMap);
}
 
源代码30 项目: jdk8u-jdk   文件: BasicLookAndFeel.java
/**
 * Sets the parent of the passed in ActionMap to be the audio action
 * map.
 */
static void installAudioActionMap(ActionMap map) {
    LookAndFeel laf = UIManager.getLookAndFeel();
    if (laf instanceof BasicLookAndFeel) {
        map.setParent(((BasicLookAndFeel)laf).getAudioActionMap());
    }
}