Java Code Examples for java.awt.event.InputEvent#BUTTON3_DOWN_MASK
The following examples show how to use
java.awt.event.InputEvent#BUTTON3_DOWN_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: WMouseDragGestureRecognizer.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * 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()); }
Example 2
Source File: WMouseDragGestureRecognizer.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * 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()); }
Example 3
Source File: Robot.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
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; }
Example 4
Source File: DragSourceDragEvent.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * 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; } }
Example 5
Source File: XToolkit.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
static boolean isRightMouseButton(MouseEvent me) { int numButtons = ((Integer)getDefaultToolkit().getDesktopProperty("awt.mouse.numButtons")).intValue(); switch (me.getID()) { case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: return ((numButtons == 2 && me.getButton() == MouseEvent.BUTTON2) || (numButtons > 2 && me.getButton() == MouseEvent.BUTTON3)); case MouseEvent.MOUSE_ENTERED: case MouseEvent.MOUSE_EXITED: case MouseEvent.MOUSE_CLICKED: case MouseEvent.MOUSE_DRAGGED: return ((numButtons == 2 && (me.getModifiersEx() & InputEvent.BUTTON2_DOWN_MASK) != 0) || (numButtons > 2 && (me.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) != 0)); } return false; }
Example 6
Source File: DragSourceDragEvent.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
/** * 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; } }
Example 7
Source File: XToolkit.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
static boolean isRightMouseButton(MouseEvent me) { int numButtons = ((Integer)getDefaultToolkit().getDesktopProperty("awt.mouse.numButtons")).intValue(); switch (me.getID()) { case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: return ((numButtons == 2 && me.getButton() == MouseEvent.BUTTON2) || (numButtons > 2 && me.getButton() == MouseEvent.BUTTON3)); case MouseEvent.MOUSE_ENTERED: case MouseEvent.MOUSE_EXITED: case MouseEvent.MOUSE_CLICKED: case MouseEvent.MOUSE_DRAGGED: return ((numButtons == 2 && (me.getModifiersEx() & InputEvent.BUTTON2_DOWN_MASK) != 0) || (numButtons > 2 && (me.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) != 0)); } return false; }
Example 8
Source File: Robot.java From jdk-1.7-annotated with Apache License 2.0 | 6 votes |
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; }
Example 9
Source File: WMouseDragGestureRecognizer.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * 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()); }
Example 10
Source File: WMouseDragGestureRecognizer.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * 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()); }
Example 11
Source File: XToolkit.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
static boolean isRightMouseButton(MouseEvent me) { int numButtons = ((Integer)getDefaultToolkit().getDesktopProperty("awt.mouse.numButtons")).intValue(); switch (me.getID()) { case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: return ((numButtons == 2 && me.getButton() == MouseEvent.BUTTON2) || (numButtons > 2 && me.getButton() == MouseEvent.BUTTON3)); case MouseEvent.MOUSE_ENTERED: case MouseEvent.MOUSE_EXITED: case MouseEvent.MOUSE_CLICKED: case MouseEvent.MOUSE_DRAGGED: return ((numButtons == 2 && (me.getModifiersEx() & InputEvent.BUTTON2_DOWN_MASK) != 0) || (numButtons > 2 && (me.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) != 0)); } return false; }
Example 12
Source File: DragSourceDragEvent.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * 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; } }
Example 13
Source File: DragSourceDragEvent.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * 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; } }
Example 14
Source File: AWTKeyStroke.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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; }
Example 15
Source File: AWTKeyStroke.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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; }
Example 16
Source File: DeviceTest.java From marathonv5 with Apache License 2.0 | 5 votes |
protected String getModifiersExText(int modifiers) { StringBuffer buf = new StringBuffer(); if ((modifiers & InputEvent.META_DOWN_MASK) != 0) { buf.append("Meta"); buf.append("+"); } if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0) { buf.append("Ctrl"); buf.append("+"); } if ((modifiers & InputEvent.ALT_DOWN_MASK) != 0) { buf.append("Alt"); buf.append("+"); } if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0) { buf.append("Shift"); buf.append("+"); } if ((modifiers & InputEvent.ALT_GRAPH_DOWN_MASK) != 0) { buf.append("Alt Graph"); buf.append("+"); } if ((modifiers & InputEvent.BUTTON1_DOWN_MASK) != 0) { buf.append("Button1"); buf.append("+"); } if ((modifiers & InputEvent.BUTTON2_DOWN_MASK) != 0) { buf.append("Button2"); buf.append("+"); } if ((modifiers & InputEvent.BUTTON3_DOWN_MASK) != 0) { buf.append("Button3"); buf.append("+"); } return buf.toString(); }
Example 17
Source File: GTreeDragNDropAdapter.java From ghidra with Apache License 2.0 | 5 votes |
@Override public void dragGestureRecognized(DragGestureEvent dragEvent) { // check input event: if any button other than MB1 is pressed, // don't attempt to process the drag and drop event. InputEvent ie = dragEvent.getTriggerEvent(); int modifiers = ie.getModifiersEx(); if ((modifiers & InputEvent.BUTTON2_DOWN_MASK) != 0 || (modifiers & InputEvent.BUTTON3_DOWN_MASK) != 0) { return; } Point p = dragEvent.getDragOrigin(); TreePath path = tree.getClosestPathForLocation(p.x, p.y); if (!tree.isPathSelected(path)) { return; } List<GTreeNode> selectedData = createSelectionList(tree.getSelectionPaths()); if (!dragNDropHandler.isStartDragOk(selectedData, dragEvent.getDragAction())) { return; } Transferable transferable = new GTreeNodeTransferable(dragNDropHandler, selectedData); Image image = getDragImage(selectedData); try { dragEvent.startDrag(DragSource.DefaultCopyNoDrop, image, new Point(-10, -30), transferable, this); } catch (InvalidDnDOperationException exc) { Msg.debug(this, "Unable to initiate drag from tree", exc); } }
Example 18
Source File: AWTKeyStroke.java From Java8CN with Apache License 2.0 | 5 votes |
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; }
Example 19
Source File: EventQueueDevice.java From marathonv5 with Apache License 2.0 | 5 votes |
public int getButtonMask() { if (button1Pressed) { return InputEvent.BUTTON1_DOWN_MASK; } if (button2Pressed) { return InputEvent.BUTTON2_DOWN_MASK; } if (button3Pressed) { return InputEvent.BUTTON3_DOWN_MASK; } return 0; }
Example 20
Source File: AWTKeyStroke.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@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; }