Java 类java.awt.AWTKeyStroke 实例源码

项目:incubator-netbeans    文件:ShortcutAndMenuKeyEventProcessor.java   
public static synchronized void install() {
    if(installed) {
        return;
    }

    ShortcutAndMenuKeyEventProcessor instance = getDefault();

    KeyboardFocusManager keyboardFocusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
    keyboardFocusManager.addKeyEventDispatcher(instance);
    keyboardFocusManager.addKeyEventPostProcessor(instance);
    // #63252: Disable focus traversal functionality of Ctrl+Tab and Ctrl+Shift+Tab,
    // to allow our own document switching (RecentViewListAction)
    defaultForward = keyboardFocusManager.getDefaultFocusTraversalKeys(
                        KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
    defaultBackward = keyboardFocusManager.getDefaultFocusTraversalKeys(
                        KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
    keyboardFocusManager.setDefaultFocusTraversalKeys(
        KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
        Collections.singleton(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, 0))
    );                
    keyboardFocusManager.setDefaultFocusTraversalKeys(
        KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
        Collections.singleton(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, KeyEvent.SHIFT_DOWN_MASK))
    );                
}
项目:incubator-netbeans    文件:ShortcutEnterPanel.java   
/** Creates new form ShortcutCustomizerPanel */
public ShortcutEnterPanel() {
    initComponents();
    bTab = new JButton();
    bClear = new JButton();
    loc(bTab, "CTL_Tab");
    loc(bClear, "CTL_Clear");
    tfShortcut.setFocusTraversalKeys(
            KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
            Collections.<AWTKeyStroke>emptySet()
            );
    tfShortcut.setFocusTraversalKeys(
            KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS,
            Collections.<AWTKeyStroke>emptySet()
            );
    tfShortcut.setFocusTraversalKeys(
            KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS,
            Collections.<AWTKeyStroke>emptySet()
            );

    tfShortcut.addKeyListener(listener);        
}
项目:OpenJSharp    文件:XEmbedHelper.java   
AWTKeyStroke getKeyStrokeForKeySym(long keysym, long state) {
    XBaseWindow.checkSecurity();

    int keycode;

    XToolkit.awtLock();
    try {
        XKeysym.Keysym2JavaKeycode kc = XKeysym.getJavaKeycode( keysym );
        if(kc == null) {
            keycode = java.awt.event.KeyEvent.VK_UNDEFINED;
        }else{
            keycode = kc.getJavaKeycode();
        }
    } finally {
        XToolkit.awtUnlock();
    }

    int modifiers = getModifiers((int)state);
    return AWTKeyStroke.getAWTKeyStroke(keycode, modifiers);
}
项目:jdk8u-jdk    文件:XEmbedHelper.java   
AWTKeyStroke getKeyStrokeForKeySym(long keysym, long state) {
    XBaseWindow.checkSecurity();

    int keycode;

    XToolkit.awtLock();
    try {
        XKeysym.Keysym2JavaKeycode kc = XKeysym.getJavaKeycode( keysym );
        if(kc == null) {
            keycode = java.awt.event.KeyEvent.VK_UNDEFINED;
        }else{
            keycode = kc.getJavaKeycode();
        }
    } finally {
        XToolkit.awtUnlock();
    }

    int modifiers = getModifiers((int)state);
    return AWTKeyStroke.getAWTKeyStroke(keycode, modifiers);
}
项目:openjdk-jdk10    文件:XEmbedHelper.java   
AWTKeyStroke getKeyStrokeForKeySym(long keysym, long state) {
    XBaseWindow.checkSecurity();

    int keycode;

    XToolkit.awtLock();
    try {
        XKeysym.Keysym2JavaKeycode kc = XKeysym.getJavaKeycode( keysym );
        if(kc == null) {
            keycode = java.awt.event.KeyEvent.VK_UNDEFINED;
        }else{
            keycode = kc.getJavaKeycode();
        }
    } finally {
        XToolkit.awtUnlock();
    }

    int modifiers = getModifiers((int)state);
    return AWTKeyStroke.getAWTKeyStroke(keycode, modifiers);
}
项目:openjdk-jdk10    文件:TestAWTKeyStroke.java   
private static void checkAWTKeyStroke(int keyCode, int modifiers,
        boolean onKeyRelease) throws Exception {

    AWTKeyStroke awtKeyStroke1 = AWTKeyStroke.getAWTKeyStroke(
            keyCode, modifiers, onKeyRelease);

    checkAWTKeyStroke(awtKeyStroke1, keyCode, modifiers, onKeyRelease);

    AWTKeyStroke awtKeyStroke2 = AWTKeyStroke.getAWTKeyStroke(
            keyCode, modifiers, onKeyRelease);

    if (awtKeyStroke1 != awtKeyStroke2) {
        throw new RuntimeException("AWTKeyStroke is not cached!");
    }

    checkSerializedKeyStroke(awtKeyStroke1);
}
项目:openjdk-jdk10    文件:TestAWTKeyStroke.java   
private static void checkSerializedKeyStrokes(int keyCode, int modifiers,
        boolean onKeyRelease) throws Exception {

    AWTKeyStroke awtKeyStroke = AWTKeyStroke.getAWTKeyStroke(
            keyCode, modifiers, onKeyRelease);

    KeyStroke keyStroke = KeyStroke.getKeyStroke(
            keyCode, modifiers, onKeyRelease);

    if (awtKeyStroke != getSerializedAWTKeyStroke(awtKeyStroke)) {
        throw new RuntimeException("Serialized AWTKeyStroke is not cached!");
    }

    awtKeyStroke = AWTKeyStroke.getAWTKeyStroke(
            keyCode, modifiers, !onKeyRelease);

    if (!keyStroke.equals(getSerializedAWTKeyStroke(keyStroke))) {
        throw new RuntimeException("Serialized KeyStroke is not cached!");
    }
}
项目:openjdk9    文件:XEmbedHelper.java   
AWTKeyStroke getKeyStrokeForKeySym(long keysym, long state) {
    XBaseWindow.checkSecurity();

    int keycode;

    XToolkit.awtLock();
    try {
        XKeysym.Keysym2JavaKeycode kc = XKeysym.getJavaKeycode( keysym );
        if(kc == null) {
            keycode = java.awt.event.KeyEvent.VK_UNDEFINED;
        }else{
            keycode = kc.getJavaKeycode();
        }
    } finally {
        XToolkit.awtUnlock();
    }

    int modifiers = getModifiers((int)state);
    return AWTKeyStroke.getAWTKeyStroke(keycode, modifiers);
}
项目:openjdk9    文件:TestAWTKeyStroke.java   
private static void checkAWTKeyStroke(int keyCode, int modifiers,
        boolean onKeyRelease) throws Exception {

    AWTKeyStroke awtKeyStroke1 = AWTKeyStroke.getAWTKeyStroke(
            keyCode, modifiers, onKeyRelease);

    checkAWTKeyStroke(awtKeyStroke1, keyCode, modifiers, onKeyRelease);

    AWTKeyStroke awtKeyStroke2 = AWTKeyStroke.getAWTKeyStroke(
            keyCode, modifiers, onKeyRelease);

    if (awtKeyStroke1 != awtKeyStroke2) {
        throw new RuntimeException("AWTKeyStroke is not cached!");
    }

    checkSerializedKeyStroke(awtKeyStroke1);
}
项目:openjdk9    文件:TestAWTKeyStroke.java   
private static void checkSerializedKeyStrokes(int keyCode, int modifiers,
        boolean onKeyRelease) throws Exception {

    AWTKeyStroke awtKeyStroke = AWTKeyStroke.getAWTKeyStroke(
            keyCode, modifiers, onKeyRelease);

    KeyStroke keyStroke = KeyStroke.getKeyStroke(
            keyCode, modifiers, onKeyRelease);

    if (awtKeyStroke != getSerializedAWTKeyStroke(awtKeyStroke)) {
        throw new RuntimeException("Serialized AWTKeyStroke is not cached!");
    }

    awtKeyStroke = AWTKeyStroke.getAWTKeyStroke(
            keyCode, modifiers, !onKeyRelease);

    if (!keyStroke.equals(getSerializedAWTKeyStroke(keyStroke))) {
        throw new RuntimeException("Serialized KeyStroke is not cached!");
    }
}
项目:jdk8u_jdk    文件:XEmbedHelper.java   
AWTKeyStroke getKeyStrokeForKeySym(long keysym, long state) {
    XBaseWindow.checkSecurity();

    int keycode;

    XToolkit.awtLock();
    try {
        XKeysym.Keysym2JavaKeycode kc = XKeysym.getJavaKeycode( keysym );
        if(kc == null) {
            keycode = java.awt.event.KeyEvent.VK_UNDEFINED;
        }else{
            keycode = kc.getJavaKeycode();
        }
    } finally {
        XToolkit.awtUnlock();
    }

    int modifiers = getModifiers((int)state);
    return AWTKeyStroke.getAWTKeyStroke(keycode, modifiers);
}
项目:lookaside_java-1.8.0-openjdk    文件:XEmbedHelper.java   
AWTKeyStroke getKeyStrokeForKeySym(long keysym, long state) {
    XBaseWindow.checkSecurity();

    int keycode;

    XToolkit.awtLock();
    try {
        XKeysym.Keysym2JavaKeycode kc = XKeysym.getJavaKeycode( keysym );
        if(kc == null) {
            keycode = java.awt.event.KeyEvent.VK_UNDEFINED;
        }else{
            keycode = kc.getJavaKeycode();
        }
    } finally {
        XToolkit.awtUnlock();
    }

    int modifiers = getModifiers((int)state);
    return AWTKeyStroke.getAWTKeyStroke(keycode, modifiers);
}
项目:pitanga-system    文件:EnterComoTab.java   
/**
 * Este método faz com que o ENTER seja considerado como TAB, em componentes
 * como um JTextField. Além disso, permite a navegação com as setas para
 * cima e para baixo.
 *
 * @param comp O componente.
 */
public static void considerarEnterComoTab(Component comp) {
    Set<AWTKeyStroke> newKeystrokes;
    newKeystrokes = new HashSet<AWTKeyStroke>(
            comp.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS));
    newKeystrokes.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_ENTER, 0));
    newKeystrokes.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_DOWN, 0));
    newKeystrokes.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_KP_DOWN, 0));
    comp.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
            newKeystrokes);
    newKeystrokes = new HashSet<AWTKeyStroke>(
            comp.getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS));
    newKeystrokes.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_ENTER,
            InputEvent.SHIFT_DOWN_MASK));
    newKeystrokes.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_UP, 0));
    newKeystrokes.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_KP_UP, 0));
    comp.setFocusTraversalKeys(
            KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, newKeystrokes);
}
项目:pitanga-system    文件:EnterComoTab.java   
/**
 * Este método faz com que as setas sejam consideradas como TAB, e deve ser
 * usado em um botão qualquer.
 *
 * @param comp O componente.
 */
public static void considerarSetaComoTab(JButton comp) {
    Set<AWTKeyStroke> newKeystrokes;
    newKeystrokes = new HashSet<AWTKeyStroke>(
            comp.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS));
    newKeystrokes.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_DOWN, 0));
    newKeystrokes.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_KP_DOWN, 0));
    comp.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
            newKeystrokes);
    newKeystrokes = new HashSet<AWTKeyStroke>(
            comp.getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS));
    newKeystrokes.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_UP, 0));
    newKeystrokes.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_KP_UP, 0));
    comp.setFocusTraversalKeys(
            KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, newKeystrokes);
}
项目:pitanga-system    文件:GUIUtils.java   
/**
 * Este método faz com que o ENTER seja considerado como TAB, em componentes
 * como um JTextField. Além disso, permite a navegação com as setas para
 * esquerda e para direita.
 *
 * @param comp O componente.
 */
public static void considerarEnterComoTab(Component comp) {
    Set<AWTKeyStroke> newKeystrokes;
    newKeystrokes = new HashSet<AWTKeyStroke>(
            comp.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS));
    newKeystrokes.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_ENTER, 0));
    newKeystrokes.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_RIGHT, 0));
    newKeystrokes.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_KP_RIGHT, 0));
    comp.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
            newKeystrokes);
    newKeystrokes = new HashSet<AWTKeyStroke>(
            comp.getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS));
    newKeystrokes.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_ENTER,
            InputEvent.SHIFT_DOWN_MASK));
    newKeystrokes.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_LEFT, 0));
    newKeystrokes.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_KP_LEFT, 0));
    comp.setFocusTraversalKeys(
            KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, newKeystrokes);
}
项目:pitanga-system    文件:GUIUtils.java   
/**
 * Este método faz com que as setas sejam consideradas como TAB, e deve ser
 * usado em um botão qualquer.
 *
 * @param comp O componente.
 */
public static void considerarSetaComoTab(JButton comp) {
    Set<AWTKeyStroke> newKeystrokes;
    newKeystrokes = new HashSet<AWTKeyStroke>(
            comp.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS));
    newKeystrokes.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_RIGHT, 0));
    newKeystrokes.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_KP_RIGHT, 0));
    comp.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
            newKeystrokes);
    newKeystrokes = new HashSet<AWTKeyStroke>(
            comp.getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS));
    newKeystrokes.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_LEFT, 0));
    newKeystrokes.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_KP_LEFT, 0));
    comp.setFocusTraversalKeys(
            KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, newKeystrokes);
}
项目:infobip-open-jdk-8    文件:XEmbedHelper.java   
AWTKeyStroke getKeyStrokeForKeySym(long keysym, long state) {
    XBaseWindow.checkSecurity();

    int keycode;

    XToolkit.awtLock();
    try {
        XKeysym.Keysym2JavaKeycode kc = XKeysym.getJavaKeycode( keysym );
        if(kc == null) {
            keycode = java.awt.event.KeyEvent.VK_UNDEFINED;
        }else{
            keycode = kc.getJavaKeycode();
        }
    } finally {
        XToolkit.awtUnlock();
    }

    int modifiers = getModifiers((int)state);
    return AWTKeyStroke.getAWTKeyStroke(keycode, modifiers);
}
项目:jdk8u-dev-jdk    文件:XEmbedHelper.java   
AWTKeyStroke getKeyStrokeForKeySym(long keysym, long state) {
    XBaseWindow.checkSecurity();

    int keycode;

    XToolkit.awtLock();
    try {
        XKeysym.Keysym2JavaKeycode kc = XKeysym.getJavaKeycode( keysym );
        if(kc == null) {
            keycode = java.awt.event.KeyEvent.VK_UNDEFINED;
        }else{
            keycode = kc.getJavaKeycode();
        }
    } finally {
        XToolkit.awtUnlock();
    }

    int modifiers = getModifiers((int)state);
    return AWTKeyStroke.getAWTKeyStroke(keycode, modifiers);
}
项目:jdk7-jdk    文件:XEmbedHelper.java   
AWTKeyStroke getKeyStrokeForKeySym(long keysym, long state) {
    XBaseWindow.checkSecurity();

    int keycode;

    XToolkit.awtLock();
    try {
        XKeysym.Keysym2JavaKeycode kc = XKeysym.getJavaKeycode( keysym );
        if(kc == null) {
            keycode = java.awt.event.KeyEvent.VK_UNDEFINED;
        }else{
            keycode = kc.getJavaKeycode();
        }
    } finally {
        XToolkit.awtUnlock();
    }

    int modifiers = getModifiers((int)state);
    return AWTKeyStroke.getAWTKeyStroke(keycode, modifiers);
}
项目:cac-agent    文件:SwingIdentityKeyChooser.java   
private void bindArrowKeys(JDialog dialog) {
    {
        Set<AWTKeyStroke> forwardKeys = dialog.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
        Set<AWTKeyStroke> newForwardKeys = new HashSet<>(forwardKeys);
        newForwardKeys.add(KeyStroke.getKeyStroke("DOWN"));
        newForwardKeys.add(KeyStroke.getKeyStroke("RIGHT"));
        dialog.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, newForwardKeys);
    }

    {
        Set<AWTKeyStroke> backwardKeys = dialog.getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
        Set<AWTKeyStroke> newBackwardKeys = new HashSet<>(backwardKeys);
        newBackwardKeys.add(KeyStroke.getKeyStroke("UP"));
        newBackwardKeys.add(KeyStroke.getKeyStroke("LEFT"));
        dialog.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, newBackwardKeys);
    }
}
项目:openjdk-source-code-learn    文件:XEmbedHelper.java   
AWTKeyStroke getKeyStrokeForKeySym(long keysym, long state) {
    XBaseWindow.checkSecurity();

    int keycode;

    XToolkit.awtLock();
    try {
        XKeysym.Keysym2JavaKeycode kc = XKeysym.getJavaKeycode( keysym );
        if(kc == null) {
            keycode = java.awt.event.KeyEvent.VK_UNDEFINED;
        }else{
            keycode = kc.getJavaKeycode();
        }
    } finally {
        XToolkit.awtUnlock();
    }

    int modifiers = getModifiers((int)state);
    return AWTKeyStroke.getAWTKeyStroke(keycode, modifiers);
}
项目:OLD-OpenJDK8    文件:XEmbedHelper.java   
AWTKeyStroke getKeyStrokeForKeySym(long keysym, long state) {
    XBaseWindow.checkSecurity();

    int keycode;

    XToolkit.awtLock();
    try {
        XKeysym.Keysym2JavaKeycode kc = XKeysym.getJavaKeycode( keysym );
        if(kc == null) {
            keycode = java.awt.event.KeyEvent.VK_UNDEFINED;
        }else{
            keycode = kc.getJavaKeycode();
        }
    } finally {
        XToolkit.awtUnlock();
    }

    int modifiers = getModifiers((int)state);
    return AWTKeyStroke.getAWTKeyStroke(keycode, modifiers);
}
项目:cn1    文件:BasicTextUI.java   
final Set<AWTKeyStroke> getDefaultFocusTraversalKeys(final int mode) {
    Set<AWTKeyStroke> result = component.getFocusTraversalKeys(mode);

    if (result == null) {
        result = new LinkedHashSet<AWTKeyStroke>();
        if (mode == KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS) {
            result.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,
                                        InputEvent.CTRL_DOWN_MASK));
        } else {
            result.add(KeyStroke
                       .getKeyStroke(KeyEvent.VK_TAB,
                               InputEvent.CTRL_DOWN_MASK
                                     | InputEvent.SHIFT_DOWN_MASK));
        }
   } else {
       result = new LinkedHashSet<AWTKeyStroke>(result);
   }

   return result;
}
项目:wandora    文件:SimpleField.java   
public void initialize() {
    this.addMouseListener(this);
    // this.setFocusTraversalKeysEnabled(false);
    this.addKeyListener(this);
    this.setFocusable(true);
    this.addFocusListener(this);
    this.setFocusTraversalKeysEnabled(true);
    this.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,new HashSet(new EasyVector(new Object[]{AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,0)})));
    this.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,new HashSet(new EasyVector(new Object[]{AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,InputEvent.SHIFT_DOWN_MASK)})));
    this.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));

    // undoManager = new UndoManager();
    // Document document = this.getDocument();
    // document.addUndoableEditListener(undoManager);

    this.setMargin(defaultMargins);

    this.setDragEnabled(true);
    dt = new DropTarget(this, DnDConstants.ACTION_COPY_OR_MOVE, this);

    setPopupMenu();
}
项目:incubator-netbeans    文件:ShortcutsDialog.java   
void init(ShortcutsFinder f) {
        this.f = f;
        loc (lShortcut, "Shortcut"); //NOI18N
        lConflict.setForeground (Color.red);
        loc (bTab, "CTL_Tab"); //NOI18N
        bTab.getAccessibleContext().setAccessibleName(loc("AN_Tab")); //NOI18N
        bTab.getAccessibleContext().setAccessibleDescription(loc("AD_Tab")); //NOI18N
        loc (bClear, "CTL_Clear"); //NOI18N
        bClear.getAccessibleContext().setAccessibleName(loc("AN_Clear")); //NOI18N
        bClear.getAccessibleContext().setAccessibleDescription(loc("AD_Clear")); //NOI18N
        tfShortcut.setFocusTraversalKeys (
            KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, 
            Collections.<AWTKeyStroke>emptySet()
        );
        tfShortcut.setFocusTraversalKeys (
            KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS, 
            Collections.<AWTKeyStroke>emptySet()
        );
        tfShortcut.getAccessibleContext().setAccessibleName(loc("AN_Shortcut")); //NOI18N
        tfShortcut.getAccessibleContext().setAccessibleDescription(loc("AD_Shortcut")); //NOI18N
        lShortcut.setDisplayedMnemonic(loc("CTL_Shortcut_Mnemonic").charAt(0));
//        tfShortcut.setFocusTraversalKeys (
//            KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, 
//            Collections.EMPTY_SET
//        );
        tfShortcut.setFocusTraversalKeys (
            KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, 
            Collections.<AWTKeyStroke>emptySet()
        );
        listener = new Listener ();
        tfShortcut.addKeyListener(listener);
    }
项目:incubator-netbeans    文件:FileSelectorField.java   
private void setTabTraversalEnabled(boolean enabled) {
    Set<AWTKeyStroke> tKeys = getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
    Set<AWTKeyStroke> newTKeys = new HashSet<>(tKeys);
    if (enabled) {
        newTKeys.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, 0));
    } else {
        newTKeys.remove(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, 0));
    }
    setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, newTKeys);
}
项目:OpenJSharp    文件:MetaData.java   
protected Expression instantiate(Object oldInstance, Encoder out) {
    AWTKeyStroke key = (AWTKeyStroke) oldInstance;

    char ch = key.getKeyChar();
    int code = key.getKeyCode();
    int mask = key.getModifiers();
    boolean onKeyRelease = key.isOnKeyRelease();

    Object[] args = null;
    if (ch == KeyEvent.CHAR_UNDEFINED) {
        args = !onKeyRelease
                ? new Object[]{code, mask}
                : new Object[]{code, mask, onKeyRelease};
    } else if (code == KeyEvent.VK_UNDEFINED) {
        if (!onKeyRelease) {
            args = (mask == 0)
                    ? new Object[]{ch}
                    : new Object[]{ch, mask};
        } else if (mask == 0) {
            args = new Object[]{ch, onKeyRelease};
        }
    }
    if (args == null) {
        throw new IllegalStateException("Unsupported KeyStroke: " + key);
    }
    Class<?> type = key.getClass();
    String name = type.getName();
    // get short name of the class
    int index = name.lastIndexOf('.') + 1;
    if (index > 0) {
        name = name.substring(index);
    }
    return new Expression( key, type, "get" + name, args );
}
项目:OpenJSharp    文件:InputContext.java   
/**
 * Checks the key event is the input method selection key or not.
 */
private boolean checkInputMethodSelectionKey(KeyEvent event) {
    if (inputMethodSelectionKey != null) {
        AWTKeyStroke aKeyStroke = AWTKeyStroke.getAWTKeyStrokeForEvent(event);
        return inputMethodSelectionKey.equals(aKeyStroke);
    } else {
        return false;
    }
}
项目:OpenJSharp    文件:InputContext.java   
private AWTKeyStroke getInputMethodSelectionKeyStroke(Preferences root) {
    try {
        if (root.nodeExists(inputMethodSelectionKeyPath)) {
            Preferences node = root.node(inputMethodSelectionKeyPath);
            int keyCode = node.getInt(inputMethodSelectionKeyCodeName, KeyEvent.VK_UNDEFINED);
            if (keyCode != KeyEvent.VK_UNDEFINED) {
                int modifiers = node.getInt(inputMethodSelectionKeyModifiersName, 0);
                return AWTKeyStroke.getAWTKeyStroke(keyCode, modifiers);
            }
        }
    } catch (BackingStoreException bse) {
    }

    return null;
}
项目:OpenJSharp    文件:XEmbedClientHelper.java   
void registerAccelerator(AWTKeyStroke stroke, int id) {
    if (active) {
        long sym = getX11KeySym(stroke);
        long mods = getX11Mods(stroke);
        sendMessage(server, XEMBED_REGISTER_ACCELERATOR, id, sym, mods);
    }
}
项目:OpenJSharp    文件:XEmbedClientHelper.java   
long getX11KeySym(AWTKeyStroke stroke) {
    XToolkit.awtLock();
    try {
        return XWindow.getKeySymForAWTKeyCode(stroke.getKeyCode());
    } finally {
        XToolkit.awtUnlock();
    }
}
项目:jdk8u-jdk    文件:MetaData.java   
protected Expression instantiate(Object oldInstance, Encoder out) {
    AWTKeyStroke key = (AWTKeyStroke) oldInstance;

    char ch = key.getKeyChar();
    int code = key.getKeyCode();
    int mask = key.getModifiers();
    boolean onKeyRelease = key.isOnKeyRelease();

    Object[] args = null;
    if (ch == KeyEvent.CHAR_UNDEFINED) {
        args = !onKeyRelease
                ? new Object[]{code, mask}
                : new Object[]{code, mask, onKeyRelease};
    } else if (code == KeyEvent.VK_UNDEFINED) {
        if (!onKeyRelease) {
            args = (mask == 0)
                    ? new Object[]{ch}
                    : new Object[]{ch, mask};
        } else if (mask == 0) {
            args = new Object[]{ch, onKeyRelease};
        }
    }
    if (args == null) {
        throw new IllegalStateException("Unsupported KeyStroke: " + key);
    }
    Class<?> type = key.getClass();
    String name = type.getName();
    // get short name of the class
    int index = name.lastIndexOf('.') + 1;
    if (index > 0) {
        name = name.substring(index);
    }
    return new Expression( key, type, "get" + name, args );
}
项目:jdk8u-jdk    文件:InputContext.java   
/**
 * Checks the key event is the input method selection key or not.
 */
private boolean checkInputMethodSelectionKey(KeyEvent event) {
    if (inputMethodSelectionKey != null) {
        AWTKeyStroke aKeyStroke = AWTKeyStroke.getAWTKeyStrokeForEvent(event);
        return inputMethodSelectionKey.equals(aKeyStroke);
    } else {
        return false;
    }
}
项目:jdk8u-jdk    文件:InputContext.java   
private AWTKeyStroke getInputMethodSelectionKeyStroke(Preferences root) {
    try {
        if (root.nodeExists(inputMethodSelectionKeyPath)) {
            Preferences node = root.node(inputMethodSelectionKeyPath);
            int keyCode = node.getInt(inputMethodSelectionKeyCodeName, KeyEvent.VK_UNDEFINED);
            if (keyCode != KeyEvent.VK_UNDEFINED) {
                int modifiers = node.getInt(inputMethodSelectionKeyModifiersName, 0);
                return AWTKeyStroke.getAWTKeyStroke(keyCode, modifiers);
            }
        }
    } catch (BackingStoreException bse) {
    }

    return null;
}
项目:jdk8u-jdk    文件:XEmbedClientHelper.java   
void registerAccelerator(AWTKeyStroke stroke, int id) {
    if (active) {
        long sym = getX11KeySym(stroke);
        long mods = getX11Mods(stroke);
        sendMessage(server, XEMBED_REGISTER_ACCELERATOR, id, sym, mods);
    }
}
项目:jdk8u-jdk    文件:XEmbedClientHelper.java   
long getX11KeySym(AWTKeyStroke stroke) {
    XToolkit.awtLock();
    try {
        return XWindow.getKeySymForAWTKeyCode(stroke.getKeyCode());
    } finally {
        XToolkit.awtUnlock();
    }
}
项目:openjdk-jdk10    文件:MetaData.java   
protected Expression instantiate(Object oldInstance, Encoder out) {
    AWTKeyStroke key = (AWTKeyStroke) oldInstance;

    char ch = key.getKeyChar();
    int code = key.getKeyCode();
    int mask = key.getModifiers();
    boolean onKeyRelease = key.isOnKeyRelease();

    Object[] args = null;
    if (ch == KeyEvent.CHAR_UNDEFINED) {
        args = !onKeyRelease
                ? new Object[]{code, mask}
                : new Object[]{code, mask, onKeyRelease};
    } else if (code == KeyEvent.VK_UNDEFINED) {
        if (!onKeyRelease) {
            args = (mask == 0)
                    ? new Object[]{ch}
                    : new Object[]{ch, mask};
        } else if (mask == 0) {
            args = new Object[]{ch, onKeyRelease};
        }
    }
    if (args == null) {
        throw new IllegalStateException("Unsupported KeyStroke: " + key);
    }
    Class<?> type = key.getClass();
    String name = type.getName();
    // get short name of the class
    int index = name.lastIndexOf('.') + 1;
    if (index > 0) {
        name = name.substring(index);
    }
    return new Expression( key, type, "get" + name, args );
}
项目:openjdk-jdk10    文件:InputContext.java   
/**
 * Checks the key event is the input method selection key or not.
 */
private boolean checkInputMethodSelectionKey(KeyEvent event) {
    if (inputMethodSelectionKey != null) {
        AWTKeyStroke aKeyStroke = AWTKeyStroke.getAWTKeyStrokeForEvent(event);
        return inputMethodSelectionKey.equals(aKeyStroke);
    } else {
        return false;
    }
}
项目:openjdk-jdk10    文件:InputContext.java   
private AWTKeyStroke getInputMethodSelectionKeyStroke(Preferences root) {
    try {
        if (root.nodeExists(inputMethodSelectionKeyPath)) {
            Preferences node = root.node(inputMethodSelectionKeyPath);
            int keyCode = node.getInt(inputMethodSelectionKeyCodeName, KeyEvent.VK_UNDEFINED);
            if (keyCode != KeyEvent.VK_UNDEFINED) {
                int modifiers = node.getInt(inputMethodSelectionKeyModifiersName, 0);
                return AWTKeyStroke.getAWTKeyStroke(keyCode, modifiers);
            }
        }
    } catch (BackingStoreException bse) {
    }

    return null;
}
项目:openjdk-jdk10    文件:XEmbeddedFrame.java   
public void registerAccelerator(AWTKeyStroke stroke) {
    XEmbeddedFramePeer xefp = AWTAccessor.getComponentAccessor()
                                         .getPeer(this);
    if (xefp != null) {
        xefp.registerAccelerator(stroke);
    }
}