当前位置: 首页>>代码示例>>Java>>正文


Java InputEvent.BUTTON1_DOWN_MASK属性代码示例

本文整理汇总了Java中java.awt.event.InputEvent.BUTTON1_DOWN_MASK属性的典型用法代码示例。如果您正苦于以下问题:Java InputEvent.BUTTON1_DOWN_MASK属性的具体用法?Java InputEvent.BUTTON1_DOWN_MASK怎么用?Java InputEvent.BUTTON1_DOWN_MASK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.awt.event.InputEvent的用法示例。


在下文中一共展示了InputEvent.BUTTON1_DOWN_MASK属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mapDragOperationFromModifiers

/**
 * determine the drop action from the event
 */

protected int mapDragOperationFromModifiers(MouseEvent e) {
    int mods = e.getModifiersEx();
    int btns = mods & ButtonMask;

    // Prohibit multi-button drags.
    if (!(btns == InputEvent.BUTTON1_DOWN_MASK ||
          btns == InputEvent.BUTTON2_DOWN_MASK ||
          btns == InputEvent.BUTTON3_DOWN_MASK)) {
        return DnDConstants.ACTION_NONE;
    }

    return
        SunDragSourceContextPeer.convertModifiersToDropAction(mods,
                                                              getSourceActions());
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:WMouseDragGestureRecognizer.java

示例2: 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

示例3: test

private static void test(final int mask) throws Exception {
    final Robot r = new Robot();
    r.setAutoDelay(100);
    r.setAutoWaitForIdle(true);

    EventQueue.invokeAndWait(MouseModifiersInKeyEvent::createAndShowGUI);
    r.waitForIdle();
    EventQueue.invokeAndWait(() -> bounds = f.getBounds());

    r.mouseMove(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2);
    r.mousePress(mask);
    r.keyPress(KeyEvent.VK_A);
    r.keyRelease(KeyEvent.VK_A);

    EventQueue.invokeAndWait(() -> f.dispose());

    r.mouseRelease(mask);

    // all extended modifiers should work
    if (modifiersEX != mask) {
        System.err.println("Expected modifiersEX: " + mask);
        System.err.println("Actual modifiersEX: " + modifiersEX);
        throw new RuntimeException();
    }
    // old modifiers work only for button1
    if (modifiersEX == InputEvent.BUTTON1_DOWN_MASK) {
        if (modifiers != InputEvent.BUTTON1_MASK) {
            System.err.println("Expected modifiers: " + InputEvent.BUTTON1_MASK);
            System.err.println("Actual modifiers: " + modifiers);
            throw new RuntimeException();
        }
    }
    modifiersEX = 0;
    modifiers = 0;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:35,代码来源:MouseModifiersInKeyEvent.java

示例4: 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

示例5: 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

示例6: 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:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:DragSourceDragEvent.java

示例7: fromString

public static int fromString(String str) {
	int ret = 0;
	StringTokenizer toks = new StringTokenizer(str);
	while (toks.hasMoreTokens()) {
		String s = toks.nextToken();
		if (s.equals(CTRL))
			ret |= InputEvent.CTRL_DOWN_MASK;
		else if (s.equals(SHIFT))
			ret |= InputEvent.SHIFT_DOWN_MASK;
		else if (s.equals(ALT))
			ret |= InputEvent.ALT_DOWN_MASK;
		else if (s.equals(BUTTON1))
			ret |= InputEvent.BUTTON1_DOWN_MASK;
		else if (s.equals(BUTTON2))
			ret |= InputEvent.BUTTON2_DOWN_MASK;
		else if (s.equals(BUTTON3))
			ret |= InputEvent.BUTTON3_DOWN_MASK;
		else
			throw new NumberFormatException("InputEventUtil");
	}
	return ret;
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:22,代码来源:InputEventUtil.java

示例8: mapDragOperationFromModifiers

/**
 * determine the drop action from the event
 */

protected int mapDragOperationFromModifiers(MouseEvent e) {
    int mods = e.getModifiersEx();
    int btns = mods & ButtonMask;

    // Do not allow right mouse button drag since Motif DnD does not
    // terminate drag operation on right mouse button release.
    if (!(btns == InputEvent.BUTTON1_DOWN_MASK ||
          btns == InputEvent.BUTTON2_DOWN_MASK)) {
        return DnDConstants.ACTION_NONE;
    }

    return
        SunDragSourceContextPeer.convertModifiersToDropAction(mods,
                                                              getSourceActions());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:XMouseDragGestureRecognizer.java

示例9: 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:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:20,代码来源:Robot.java

示例10: 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:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:28,代码来源:AWTKeyStroke.java

示例11: toString

public static String toString(int mods) {
	ArrayList<String> arr = new ArrayList<String>();
	if ((mods & InputEvent.CTRL_DOWN_MASK) != 0)
		arr.add(CTRL);
	if ((mods & InputEvent.ALT_DOWN_MASK) != 0)
		arr.add(ALT);
	if ((mods & InputEvent.SHIFT_DOWN_MASK) != 0)
		arr.add(SHIFT);
	if ((mods & InputEvent.BUTTON1_DOWN_MASK) != 0)
		arr.add(BUTTON1);
	if ((mods & InputEvent.BUTTON2_DOWN_MASK) != 0)
		arr.add(BUTTON2);
	if ((mods & InputEvent.BUTTON3_DOWN_MASK) != 0)
		arr.add(BUTTON3);

	Iterator<String> it = arr.iterator();
	if (it.hasNext()) {
		StringBuilder ret = new StringBuilder();
		ret.append(it.next());
		while (it.hasNext()) {
			ret.append(" ");
			ret.append(it.next());
		}
		return ret.toString();
	} else {
		return "";
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:28,代码来源:InputEventUtil.java

示例12: inputEventGetModifiersExText

public static String inputEventGetModifiersExText(int modifiers) {
    StringBuffer sb = new StringBuffer();

    if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0) {
        sb.append("Ctrl+");
    }
    if ((modifiers & InputEvent.META_DOWN_MASK) != 0) {
        sb.append("Meta+");
    }
    if ((modifiers & InputEvent.ALT_DOWN_MASK) != 0) {
        sb.append("Alt+");
    }
    if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0) {
        sb.append("Shift+");
    }
    if ((modifiers & InputEvent.BUTTON1_DOWN_MASK) != 0) {
        sb.append("Button1+");
    }
    if ((modifiers & InputEvent.BUTTON2_DOWN_MASK) != 0) {
        sb.append("Button2+");
    }
    if ((modifiers & InputEvent.BUTTON3_DOWN_MASK) != 0) {
        sb.append("Button3+");
    }
    String text = sb.toString();
    if (text.equals("")) {
        return text;
    }
    return text.substring(0, text.length() - 1);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:30,代码来源:JavaRecorderHook.java

示例13: processMouseEvent

void processMouseEvent(MouseEvent e) {
    int left = InputEvent.BUTTON1_DOWN_MASK;
    int middle = InputEvent.BUTTON2_DOWN_MASK;
    int right = InputEvent.BUTTON3_DOWN_MASK;
    //        log.info("e.getModifiersEx()="+HexString.toString(e.getModifiersEx()));
    if ((e.getModifiersEx() & (middle)) == middle) {
        setDesiredPositionFromMouseEvent(e);
    } else if ((e.getModifiersEx() & left) == left) {
        setBallLocationFromMouseEvent(e);
    } else if ((e.getModifiersEx() & (right)) == right) {
        setTrackPositionFromMouseEvent(e);
    }
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:13,代码来源:LabyrinthBallController.java

示例14: testLassoConditions

private boolean testLassoConditions(MouseEvent e) {
	int onmask = InputEvent.BUTTON1_DOWN_MASK;
	int offmask = InputEvent.CTRL_DOWN_MASK
					| InputEvent.SHIFT_DOWN_MASK;
	return (e.getModifiersEx() & (onmask | offmask)) == onmask
			&& (enabled  || isLDown);
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:7,代码来源:LassoSelectionHandler.java

示例15: getModifiersText

static String getModifiersText(int modifiers) {
    StringBuilder buf = new StringBuilder();

    if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0 ) {
        buf.append("shift ");
    }
    if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0 ) {
        buf.append("ctrl ");
    }
    if ((modifiers & InputEvent.META_DOWN_MASK) != 0 ) {
        buf.append("meta ");
    }
    if ((modifiers & InputEvent.ALT_DOWN_MASK) != 0 ) {
        buf.append("alt ");
    }
    if ((modifiers & InputEvent.ALT_GRAPH_DOWN_MASK) != 0 ) {
        buf.append("altGraph ");
    }
    if ((modifiers & InputEvent.BUTTON1_DOWN_MASK) != 0 ) {
        buf.append("button1 ");
    }
    if ((modifiers & InputEvent.BUTTON2_DOWN_MASK) != 0 ) {
        buf.append("button2 ");
    }
    if ((modifiers & InputEvent.BUTTON3_DOWN_MASK) != 0 ) {
        buf.append("button3 ");
    }

    return buf.toString();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:30,代码来源:AWTKeyStroke.java


注:本文中的java.awt.event.InputEvent.BUTTON1_DOWN_MASK属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。