Java Code Examples for java.awt.event.ActionEvent#META_MASK

The following examples show how to use java.awt.event.ActionEvent#META_MASK . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MacroRecording.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Copied from BaseKit
 */
static boolean isValidDefaultTypedAction(ActionEvent evt) {
    // Check whether the modifiers are OK
    int mod = evt.getModifiers();
    boolean ctrl = ((mod & ActionEvent.CTRL_MASK) != 0);
    boolean alt = org.openide.util.Utilities.isMac() ? ((mod & ActionEvent.META_MASK) != 0) :
        ((mod & ActionEvent.ALT_MASK) != 0);
    return !(alt || ctrl);
}
 
Example 2
Source File: GuiBoard.java    From FancyBing with GNU General Public License v3.0 4 votes vote down vote up
private void keyPressed(KeyEvent event)
{
    int code = event.getKeyCode();
    int modifiers = event.getModifiers();
    if (code == KeyEvent.VK_ENTER)
    {
        int mask = (ActionEvent.CTRL_MASK
                    | ActionEvent.ALT_MASK
                    | ActionEvent.META_MASK);
        boolean modifiedSelect = ((modifiers & mask) != 0);
        if (getShowCursor() && m_cursor != null)
            fieldClicked(m_cursor, modifiedSelect);
        return;
    }
    if ((modifiers & ActionEvent.CTRL_MASK) != 0
        || ! getShowCursor() || m_cursor == null)
        return;
    boolean shiftModifier = ((modifiers & ActionEvent.SHIFT_MASK) != 0);
    GoPoint point = m_cursor;
    if (code == KeyEvent.VK_DOWN)
    {
        point = point.down();
        if (shiftModifier)
            while (! isHandicapLineOrEdge(point.getY()))
                point = point.down();
    }
    else if (code == KeyEvent.VK_UP)
    {
        point = point.up(m_size);
        if (shiftModifier)
            while (! isHandicapLineOrEdge(point.getY()))
                point = point.up(m_size);
    }
    else if (code == KeyEvent.VK_LEFT)
    {
        point = point.left();
        if (shiftModifier)
            while (! isHandicapLineOrEdge(point.getX()))
                point = point.left();
    }
    else if (code == KeyEvent.VK_RIGHT)
    {
        point = point.right(m_size);
        if (shiftModifier)
            while (! isHandicapLineOrEdge(point.getX()))
                point = point.right(m_size);
    }
    setCursor(point);
}
 
Example 3
Source File: DesktopApi.java    From workcraft with MIT License 4 votes vote down vote up
public static int getMenuKeyMask() {
    if (getOs().isMac()) {
        return ActionEvent.META_MASK;
    }
    return ActionEvent.CTRL_MASK;
}
 
Example 4
Source File: DesktopApi.java    From workcraft with MIT License 4 votes vote down vote up
public static String getMenuKeyName() {
    if (getMenuKeyMask() == ActionEvent.META_MASK) {
        return "Cmd";
    }
    return "Ctrl";
}
 
Example 5
Source File: GraphEditorKeyEvent.java    From workcraft with MIT License 4 votes vote down vote up
public boolean isMenuKeyDown() {
    if (DesktopApi.getMenuKeyMask() == ActionEvent.META_MASK) {
        return isMetaKeyDown();
    }
    return isCtrlKeyDown();
}
 
Example 6
Source File: GraphEditorMouseEvent.java    From workcraft with MIT License 4 votes vote down vote up
public boolean isMenuKeyDown() {
    if (DesktopApi.getMenuKeyMask() == ActionEvent.META_MASK) {
        return isMetaKeyDown();
    }
    return isCtrlKeyDown();
}