當前位置: 首頁>>代碼示例>>Java>>正文


Java InputEvent.META_MASK屬性代碼示例

本文整理匯總了Java中java.awt.event.InputEvent.META_MASK屬性的典型用法代碼示例。如果您正苦於以下問題:Java InputEvent.META_MASK屬性的具體用法?Java InputEvent.META_MASK怎麽用?Java InputEvent.META_MASK使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.awt.event.InputEvent的用法示例。


在下文中一共展示了InputEvent.META_MASK屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getModifierEx

public int getModifierEx() {
    int modifiersEx = 0;
    if (isShiftPressed()) {
        modifiersEx |= InputEvent.SHIFT_DOWN_MASK | InputEvent.SHIFT_MASK;
    }
    if (isCtrlPressed()) {
        modifiersEx |= InputEvent.CTRL_DOWN_MASK | InputEvent.CTRL_MASK;
    }
    if (isAltPressed()) {
        modifiersEx |= InputEvent.ALT_DOWN_MASK | InputEvent.ALT_MASK;
    }
    if (isMetaPressed()) {
        modifiersEx |= InputEvent.META_DOWN_MASK | InputEvent.META_MASK;
    }
    return modifiersEx;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:16,代碼來源:EventQueueDevice.java

示例2: mapNewModifiers

private static int mapNewModifiers(int modifiers) {
    if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0) {
        modifiers |= InputEvent.SHIFT_MASK;
    }
    if ((modifiers & InputEvent.ALT_DOWN_MASK) != 0) {
        modifiers |= InputEvent.ALT_MASK;
    }
    if ((modifiers & InputEvent.ALT_GRAPH_DOWN_MASK) != 0) {
        modifiers |= InputEvent.ALT_GRAPH_MASK;
    }
    if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0) {
        modifiers |= InputEvent.CTRL_MASK;
    }
    if ((modifiers & InputEvent.META_DOWN_MASK) != 0) {
        modifiers |= InputEvent.META_MASK;
    }

    return modifiers;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:19,代碼來源:AWTKeyStroke.java

示例3: mapNewModifiers

@SuppressWarnings("deprecation")
private static int mapNewModifiers(int modifiers) {
    if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0) {
        modifiers |= InputEvent.SHIFT_MASK;
    }
    if ((modifiers & InputEvent.ALT_DOWN_MASK) != 0) {
        modifiers |= InputEvent.ALT_MASK;
    }
    if ((modifiers & InputEvent.ALT_GRAPH_DOWN_MASK) != 0) {
        modifiers |= InputEvent.ALT_GRAPH_MASK;
    }
    if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0) {
        modifiers |= InputEvent.CTRL_MASK;
    }
    if ((modifiers & InputEvent.META_DOWN_MASK) != 0) {
        modifiers |= InputEvent.META_MASK;
    }

    return modifiers;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:20,代碼來源:AWTKeyStroke.java

示例4: keyPressed

@Override
public void keyPressed(KeyEvent e) {

    keyPressReceived = true;

    int code = e.getKeyCode();

    assertEQ(code, keyCode, "wrong key code");

    int mask = 0;

    if (code == KeyEvent.VK_SHIFT) {
        mask = InputEvent.SHIFT_MASK;
    } else if (code == KeyEvent.VK_CONTROL) {
        mask = InputEvent.CTRL_MASK;
    } else if (code == KeyEvent.VK_ALT) {
        mask = InputEvent.ALT_MASK;
    } else if (code == KeyEvent.VK_META) {
        mask = InputEvent.META_MASK;
    }

    int mod = e.getModifiers() & mask;
    assertEQ(mod, mask, "invalid key mask");

    synchronized (lock) { lock.notifyAll(); }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:26,代碼來源:KeyMaskTest.java

示例5: robotPressModifiers

private void robotPressModifiers(int modifiers) {
    if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
        robotPressKey(KeyEvent.VK_SHIFT, modifiers & ~InputEvent.SHIFT_MASK);
    } else if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
        robotPressKey(KeyEvent.VK_ALT_GRAPH, modifiers & ~InputEvent.ALT_GRAPH_MASK);
    } else if ((modifiers & InputEvent.ALT_MASK) != 0) {
        robotPressKey(KeyEvent.VK_ALT, modifiers & ~InputEvent.ALT_MASK);
    } else if ((modifiers & InputEvent.META_MASK) != 0) {
        robotPressKey(KeyEvent.VK_META, modifiers & ~InputEvent.META_MASK);
    } else if ((modifiers & InputEvent.CTRL_MASK) != 0) {
        robotPressKey(KeyEvent.VK_CONTROL, modifiers & ~InputEvent.CTRL_MASK);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:13,代碼來源:EventDispatcher.java

示例6: getModifier

private int getModifier(int keycode) {
    switch (keycode) {
    case KeyEvent.VK_SHIFT:
        return InputEvent.SHIFT_MASK;
    case KeyEvent.VK_CONTROL:
        return InputEvent.CTRL_MASK;
    case KeyEvent.VK_ALT:
        return InputEvent.ALT_MASK;
    case KeyEvent.VK_META:
        return InputEvent.META_MASK;
    default:
        throw new RuntimeException(OSUtils.keyEventGetKeyText(keycode) + " is not a valid modifier");
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:14,代碼來源:KeyStrokeParser.java

示例7: mapOldModifiers

private static int mapOldModifiers(int modifiers) {
    if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
        modifiers |= InputEvent.SHIFT_DOWN_MASK;
    }
    if ((modifiers & InputEvent.ALT_MASK) != 0) {
        modifiers |= InputEvent.ALT_DOWN_MASK;
    }
    if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
        modifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
    }
    if ((modifiers & InputEvent.CTRL_MASK) != 0) {
        modifiers |= InputEvent.CTRL_DOWN_MASK;
    }
    if ((modifiers & InputEvent.META_MASK) != 0) {
        modifiers |= InputEvent.META_DOWN_MASK;
    }

    modifiers &= InputEvent.SHIFT_DOWN_MASK
        | InputEvent.ALT_DOWN_MASK
        | InputEvent.ALT_GRAPH_DOWN_MASK
        | InputEvent.CTRL_DOWN_MASK
        | InputEvent.META_DOWN_MASK
        | InputEvent.BUTTON1_DOWN_MASK
        | InputEvent.BUTTON2_DOWN_MASK
        | InputEvent.BUTTON3_DOWN_MASK;

    return modifiers;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:28,代碼來源:AWTKeyStroke.java

示例8: setLabel

public void setLabel(String label, char keyChar, int keyCode, int modifiers) {
    int keyMask = modifiers;
    if (keyCode == KeyEvent.VK_UNDEFINED) {
        MenuShortcut shortcut = ((MenuItem)getTarget()).getShortcut();

        if (shortcut != null) {
            keyCode = shortcut.getKey();
            keyMask |= InputEvent.META_MASK;

            if (shortcut.usesShiftModifier()) {
                keyMask |= InputEvent.SHIFT_MASK;
            }
        }
    }

    if (label == null) {
        label = "";
    }

    // <rdar://problem/3654824>
    // Native code uses a keyChar of 0 to indicate that the
    // keyCode should be used to generate the shortcut.  Translate
    // CHAR_UNDEFINED into 0.
    if (keyChar == KeyEvent.CHAR_UNDEFINED) {
        keyChar = 0;
    }

    final String finalLabel = label;
    final char finalKeyChar = keyChar;
    final int finalKeyCode = keyCode;
    final int finalKeyMask = keyMask;
    execute(ptr -> nativeSetLabel(ptr, finalLabel, finalKeyChar,
                                  finalKeyCode, finalKeyMask));
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:34,代碼來源:CMenuItem.java

示例9: robotReleaseModifiers

private void robotReleaseModifiers(int modifiers) {
    if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
        robotReleaseKey(KeyEvent.VK_SHIFT, modifiers - (InputEvent.SHIFT_MASK & modifiers));
    } else if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
        robotReleaseKey(KeyEvent.VK_ALT_GRAPH, modifiers - (InputEvent.ALT_GRAPH_MASK & modifiers));
    } else if ((modifiers & InputEvent.ALT_MASK) != 0) {
        robotReleaseKey(KeyEvent.VK_ALT, modifiers - (InputEvent.ALT_MASK & modifiers));
    } else if ((modifiers & InputEvent.META_MASK) != 0) {
        robotReleaseKey(KeyEvent.VK_META, modifiers - (InputEvent.META_MASK & modifiers));
    } else if ((modifiers & InputEvent.CTRL_MASK) != 0) {
        robotReleaseKey(KeyEvent.VK_CONTROL, modifiers - (InputEvent.CTRL_MASK & modifiers));
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:13,代碼來源:EventDispatcher.java

示例10: mapOldModifiers

@SuppressWarnings("deprecation")
private static int mapOldModifiers(int modifiers) {
    if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
        modifiers |= InputEvent.SHIFT_DOWN_MASK;
    }
    if ((modifiers & InputEvent.ALT_MASK) != 0) {
        modifiers |= InputEvent.ALT_DOWN_MASK;
    }
    if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
        modifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
    }
    if ((modifiers & InputEvent.CTRL_MASK) != 0) {
        modifiers |= InputEvent.CTRL_DOWN_MASK;
    }
    if ((modifiers & InputEvent.META_MASK) != 0) {
        modifiers |= InputEvent.META_DOWN_MASK;
    }

    modifiers &= InputEvent.SHIFT_DOWN_MASK
        | InputEvent.ALT_DOWN_MASK
        | InputEvent.ALT_GRAPH_DOWN_MASK
        | InputEvent.CTRL_DOWN_MASK
        | InputEvent.META_DOWN_MASK
        | InputEvent.BUTTON1_DOWN_MASK
        | InputEvent.BUTTON2_DOWN_MASK
        | InputEvent.BUTTON3_DOWN_MASK;

    return modifiers;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:29,代碼來源:AWTKeyStroke.java

示例11: setLabel

@SuppressWarnings("deprecation")
public void setLabel(String label, char keyChar, int keyCode, int modifiers) {
    int keyMask = modifiers;
    if (keyCode == KeyEvent.VK_UNDEFINED) {
        MenuShortcut shortcut = ((MenuItem)getTarget()).getShortcut();

        if (shortcut != null) {
            keyCode = shortcut.getKey();
            keyMask |= InputEvent.META_MASK;

            if (shortcut.usesShiftModifier()) {
                keyMask |= InputEvent.SHIFT_MASK;
            }
        }
    }

    if (label == null) {
        label = "";
    }

    // <rdar://problem/3654824>
    // Native code uses a keyChar of 0 to indicate that the
    // keyCode should be used to generate the shortcut.  Translate
    // CHAR_UNDEFINED into 0.
    if (keyChar == KeyEvent.CHAR_UNDEFINED) {
        keyChar = 0;
    }

    final String finalLabel = label;
    final char finalKeyChar = keyChar;
    final int finalKeyCode = keyCode;
    final int finalKeyMask = keyMask;
    execute(ptr -> nativeSetLabel(ptr, finalLabel, finalKeyChar,
                                  finalKeyCode, finalKeyMask));
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:35,代碼來源:CMenuItem.java

示例12: pressModifiers

/**
 * Presses modifiers keys by robot.
 *
 * @param modifiers a combination of {@code InputEvent.*_MASK} fields.
 */
protected void pressModifiers(int modifiers) {
    if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
        pressKey(KeyEvent.VK_SHIFT, modifiers & ~InputEvent.SHIFT_MASK);
    } else if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
        pressKey(KeyEvent.VK_ALT_GRAPH, modifiers & ~InputEvent.ALT_GRAPH_MASK);
    } else if ((modifiers & InputEvent.ALT_MASK) != 0) {
        pressKey(KeyEvent.VK_ALT, modifiers & ~InputEvent.ALT_MASK);
    } else if ((modifiers & InputEvent.META_MASK) != 0) {
        pressKey(KeyEvent.VK_META, modifiers & ~InputEvent.META_MASK);
    } else if ((modifiers & InputEvent.CTRL_MASK) != 0) {
        pressKey(KeyEvent.VK_CONTROL, modifiers & ~InputEvent.CTRL_MASK);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:18,代碼來源:RobotDriver.java

示例13: ctrlOrCmdModifier

private static boolean ctrlOrCmdModifier(MouseEvent e) {
    if (Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() == InputEvent.META_MASK) { // on Mac
        return (e.getModifiersEx() & InputEvent.META_DOWN_MASK) == InputEvent.META_DOWN_MASK;
    }
    return (e.getModifiers() & InputEvent.CTRL_MASK) == InputEvent.CTRL_MASK;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:6,代碼來源:GlassPane.java

示例14: isLeftMouseButtonExt

private boolean isLeftMouseButtonExt(MouseEvent evt) {
    return (SwingUtilities.isLeftMouseButton(evt)
            && !(evt.isPopupTrigger())
            && (evt.getModifiers() & (InputEvent.META_MASK | InputEvent.ALT_MASK)) == 0);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:BaseCaret.java

示例15: actionPerformed

@Override
public void actionPerformed(ActionEvent evt) {
    boolean editors = true;
    boolean views = !documentsOnly;
    if( "immediately".equals( evt.getActionCommand() ) ) {
        TopComponent activeTc = TopComponent.getRegistry().getActivated();
        if( null != activeTc ) {
            if( TopComponentTracker.getDefault().isEditorTopComponent( activeTc ) ) {
                //switching in a document, go to some other document
                views = false;
            } else {
                //switching in a view, go to some other view
                editors = false;
                views = true;
            }
        }
    }
    
    TopComponent[] documents = getRecentWindows(editors, views);
    
    if (documents.length < 2) {
        return;
    }
    
    if(!"immediately".equals(evt.getActionCommand()) && // NOI18N
            !(evt.getSource() instanceof javax.swing.JMenuItem)) {
        // #46800: fetch key directly from action command
        KeyStroke keyStroke = Utilities.stringToKey(evt.getActionCommand());
        
        if(keyStroke != null) {
            int triggerKey = keyStroke.getKeyCode();
            int reverseKey = KeyEvent.VK_SHIFT;
            int releaseKey = 0;
            
            int modifiers = keyStroke.getModifiers();
            if((InputEvent.CTRL_MASK & modifiers) != 0) {
                releaseKey = KeyEvent.VK_CONTROL;
            } else if((InputEvent.ALT_MASK & modifiers) != 0) {
                releaseKey = KeyEvent.VK_ALT;
            } else if((InputEvent.META_MASK & modifiers) != 0) {
                releaseKey = KeyEvent.VK_META;
            }
            
            if(releaseKey != 0) {
                if (!KeyboardPopupSwitcher.isShown()) {
                    KeyboardPopupSwitcher.showPopup(documentsOnly, releaseKey, triggerKey, (evt.getModifiers() & KeyEvent.SHIFT_MASK) == 0);
                }
                return;
            }
        }
    }

    int documentIndex = (evt.getModifiers() & KeyEvent.SHIFT_MASK) == 0 ? 1 : documents.length-1;
    TopComponent tc = documents[documentIndex];
    // #37226 Unmaximized the other mode if needed.
    WindowManagerImpl wm = WindowManagerImpl.getInstance();
    ModeImpl mode = (ModeImpl) wm.findMode(tc);
    if(mode != null && mode != wm.getCurrentMaximizedMode()) {
        wm.switchMaximizedMode(null);
    }
    
    tc.requestActive();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:63,代碼來源:RecentViewListAction.java


注:本文中的java.awt.event.InputEvent.META_MASK屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。