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


Java InputEvent.BUTTON2_MASK屬性代碼示例

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


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

示例1: click

@Override public void click(Component component, Buttons button, int clickCount, int xoffset, int yoffset) {
    ensureVisible(component, new Rectangle(xoffset, yoffset, 50, 50));
    int b = InputEvent.BUTTON1_MASK;
    if (button.getButton() == 0) {
        b = InputEvent.BUTTON1_MASK;
    } else if (button.getButton() == 1) {
        b = InputEvent.BUTTON2_MASK;
    } else if (button.getButton() == 2) {
        b = InputEvent.BUTTON3_MASK;
    }
    Point compLocation = component.getLocationOnScreen();
    int x = compLocation.x + xoffset;
    int y = compLocation.y + yoffset;
    robotXmouseMove(x, y);
    for (int i = 0; i < clickCount; i++) {
        robotXmousePress(b);
        robotXmouseRelease(b);
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:19,代碼來源:RobotDevice.java

示例2: setNewModifiers

/**
 * Sets new modifiers by the old ones.
 * The mouse modifiers have higher priority than overlaying key
 * modifiers.
 */
private void setNewModifiers() {
    if ((gestureModifiers & InputEvent.BUTTON1_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON1_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON2_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON2_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON3_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON3_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.SHIFT_MASK) != 0) {
        gestureModifiers |= InputEvent.SHIFT_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.CTRL_MASK) != 0) {
        gestureModifiers |= InputEvent.CTRL_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
        gestureModifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:25,代碼來源:DragSourceDragEvent.java

示例3: setOldModifiers

/**
 * Sets old modifiers by the new ones.
 */
private void setOldModifiers() {
    if ((gestureModifiers & InputEvent.BUTTON1_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON1_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON2_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON2_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON3_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON3_MASK;
    }
    if ((gestureModifiers & InputEvent.SHIFT_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.SHIFT_MASK;
    }
    if ((gestureModifiers & InputEvent.CTRL_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.CTRL_MASK;
    }
    if ((gestureModifiers & InputEvent.ALT_GRAPH_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.ALT_GRAPH_MASK;
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:23,代碼來源:DragSourceDragEvent.java

示例4: initLegalButtonMask

private static synchronized void initLegalButtonMask() {
    if (LEGAL_BUTTON_MASK != 0) return;

    int tmpMask = 0;
    if (Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled()){
        if (Toolkit.getDefaultToolkit() instanceof SunToolkit) {
            final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
            for (int i = 0; i < buttonsNumber; i++){
                tmpMask |= InputEvent.getMaskForButton(i+1);
            }
        }
    }
    tmpMask |= InputEvent.BUTTON1_MASK|
        InputEvent.BUTTON2_MASK|
        InputEvent.BUTTON3_MASK|
        InputEvent.BUTTON1_DOWN_MASK|
        InputEvent.BUTTON2_DOWN_MASK|
        InputEvent.BUTTON3_DOWN_MASK;
    LEGAL_BUTTON_MASK = tmpMask;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:20,代碼來源:Robot.java

示例5: drag

/**
 * Drags from one point to another with the specified mouse button pressed.
 *
 * @param robot a robot to use for moving the mouse, etc.
 * @param startPoint a start point of the drag
 * @param endPoint an end point of the drag
 * @param button one of {@code InputEvent.BUTTON1_MASK},
 *     {@code InputEvent.BUTTON2_MASK}, {@code InputEvent.BUTTON3_MASK}
 *
 * @throws IllegalArgumentException if {@code button} is not one of
 *     {@code InputEvent.BUTTON1_MASK}, {@code InputEvent.BUTTON2_MASK},
 *     {@code InputEvent.BUTTON3_MASK}
 */
public static void drag(Robot robot, Point startPoint, Point endPoint, int button) {
    if (!(button == InputEvent.BUTTON1_MASK || button == InputEvent.BUTTON2_MASK
            || button == InputEvent.BUTTON3_MASK))
    {
        throw new IllegalArgumentException("invalid mouse button");
    }

    robot.mouseMove(startPoint.x, startPoint.y);
    robot.mousePress(button);
    try {
        mouseMove(robot, startPoint, endPoint);
    } finally {
        robot.mouseRelease(button);
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:28,代碼來源:Util.java

示例6: setNewModifiers

/**
 * Sets new modifiers by the old ones.
 * The mouse modifiers have higher priority than overlaying key
 * modifiers.
 */
@SuppressWarnings("deprecation")
private void setNewModifiers() {
    if ((gestureModifiers & InputEvent.BUTTON1_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON1_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON2_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON2_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON3_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON3_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.SHIFT_MASK) != 0) {
        gestureModifiers |= InputEvent.SHIFT_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.CTRL_MASK) != 0) {
        gestureModifiers |= InputEvent.CTRL_DOWN_MASK;
    }
    if ((gestureModifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
        gestureModifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:26,代碼來源:DragSourceDragEvent.java

示例7: setOldModifiers

/**
 * Sets old modifiers by the new ones.
 */
@SuppressWarnings("deprecation")
private void setOldModifiers() {
    if ((gestureModifiers & InputEvent.BUTTON1_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON1_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON2_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON2_MASK;
    }
    if ((gestureModifiers & InputEvent.BUTTON3_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.BUTTON3_MASK;
    }
    if ((gestureModifiers & InputEvent.SHIFT_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.SHIFT_MASK;
    }
    if ((gestureModifiers & InputEvent.CTRL_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.CTRL_MASK;
    }
    if ((gestureModifiers & InputEvent.ALT_GRAPH_DOWN_MASK) != 0) {
        gestureModifiers |= InputEvent.ALT_GRAPH_MASK;
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:24,代碼來源:DragSourceDragEvent.java

示例8: initLegalButtonMask

@SuppressWarnings("deprecation")
private static synchronized void initLegalButtonMask() {
    if (LEGAL_BUTTON_MASK != 0) return;

    int tmpMask = 0;
    if (Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled()){
        if (Toolkit.getDefaultToolkit() instanceof SunToolkit) {
            final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
            for (int i = 0; i < buttonsNumber; i++){
                tmpMask |= InputEvent.getMaskForButton(i+1);
            }
        }
    }
    tmpMask |= InputEvent.BUTTON1_MASK|
        InputEvent.BUTTON2_MASK|
        InputEvent.BUTTON3_MASK|
        InputEvent.BUTTON1_DOWN_MASK|
        InputEvent.BUTTON2_DOWN_MASK|
        InputEvent.BUTTON3_DOWN_MASK;
    LEGAL_BUTTON_MASK = tmpMask;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:21,代碼來源:Robot.java

示例9: drag

private static void drag(Robot r, Point startPt, Point endPt, int button) {
    if (!(button == InputEvent.BUTTON1_MASK
            || button == InputEvent.BUTTON2_MASK
            || button == InputEvent.BUTTON3_MASK)) {
        throw new IllegalArgumentException("invalid mouse button");
    }

    r.mouseMove(startPt.x, startPt.y);
    r.mousePress(button);
    try {
        mouseMove(r, startPt, endPt);
    } finally {
        r.mouseRelease(button);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:15,代碼來源:NormalBoundsTest.java

示例10: getMouseButtonDescription

/**
 * Returns a mouse button string representation. Used to print trace.
 *
 * @param button Mouse button ({@code InputEvent.BUTTON1/2/3_MASK}
 * value).
 * @return InputEvent field name.
 */
public static String getMouseButtonDescription(int button) {
    String result;
    if ((button & InputEvent.BUTTON1_MASK) != 0) {
        result = "BUTTON1";
    } else if ((button & InputEvent.BUTTON2_MASK) != 0) {
        result = "BUTTON2";
    } else if ((button & InputEvent.BUTTON3_MASK) != 0) {
        result = "BUTTON3";
    } else {
        result = "UNKNOWN_BUTTON";
    }
    return result;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:20,代碼來源:EventDispatcher.java

示例11: ViwnTranslatingGraphMousePlugin

public ViwnTranslatingGraphMousePlugin() {
    super(InputEvent.BUTTON2_MASK);
}
 
開發者ID:CLARIN-PL,項目名稱:WordnetLoom,代碼行數:3,代碼來源:ViwnGraphViewModalGraphMouse.java

示例12: oldIsMiddleMouseButton

private static boolean oldIsMiddleMouseButton(MouseEvent e) {
    return ((e.getModifiers() & InputEvent.BUTTON2_MASK) == InputEvent.BUTTON2_MASK);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:3,代碼來源:bug7146377.java


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