Java Swing Key Action registerKey(JComponent component, final int keyEvent, int modifiers, Action action)

Here you can find the source of registerKey(JComponent component, final int keyEvent, int modifiers, Action action)

Description

register Key

License

Open Source License

Declaration

public static void registerKey(JComponent component, final int keyEvent, int modifiers, Action action) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import javax.swing.*;

public class Main {
    public static void registerKey(JComponent component, final int keyEvent, int modifiers, Action action) {
        final KeyStroke stroke = KeyStroke.getKeyStroke(keyEvent, modifiers);
        component.registerKeyboardAction(action, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
    }/*from  w  w w  . jav a  2  s .c  o  m*/
}

Related

  1. makeCloseAction(final Window window)
  2. matches(Action action, KeyEvent ke)
  3. parseKeyStroke(String keyStroke)
  4. parseKeyStroke(String keyStroke)
  5. pressKey(Component component, int keyCode, int modifier)
  6. registerKeyAction(JComponent component, int keyCode, Action action)
  7. registerTabKey(Container container)
  8. registerWindowCloseKeys(JRootPane root, Action closeAction)
  9. removeTabbedPaneFocusTraversalKeyBindings( JComponent c)