Java Swing Key Event keyEventModifiersToKeyStrokeModifiers(int modifiers)

Here you can find the source of keyEventModifiersToKeyStrokeModifiers(int modifiers)

Description

key Event Modifiers To Key Stroke Modifiers

License

Open Source License

Declaration

public static int keyEventModifiersToKeyStrokeModifiers(int modifiers) 

Method Source Code

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

import java.awt.event.InputEvent;

public class Main {
    public static int keyEventModifiersToKeyStrokeModifiers(int modifiers) {
        int shift = InputEvent.SHIFT_DOWN_MASK | InputEvent.SHIFT_MASK;
        int ctrl = InputEvent.CTRL_DOWN_MASK | InputEvent.CTRL_MASK;
        int alt = InputEvent.ALT_DOWN_MASK | InputEvent.ALT_MASK;
        switch (modifiers) {
        case 1://from  w  w  w. j  a v  a2  s.  c  o  m
            return shift;
        case 2:
            return ctrl;
        case 3:
            return shift | ctrl;
        case 8:
            return alt;
        case 9:
            return shift | alt;
        case 10:
            return ctrl | alt;
        case 11:
            return ctrl | shift | alt;
        }
        return 0;
    }
}

Related

  1. checkRowDownEvent(KeyEvent evt)
  2. esFecha(KeyEvent e)
  3. insertKeyListener(Component component, KeyListener l, int index)
  4. keyEventGetKeyText(int keycode)
  5. keyStrokeModMac(String keyStrokeStr)
  6. press(int key)
  7. pressKey(final int key)
  8. recipientHintSelected(String hintString, TextField toList, boolean shiftKeyPressed)