Java Code Examples for java.awt.event.MouseEvent#getModifiersEx()
The following examples show how to use
java.awt.event.MouseEvent#getModifiersEx() .
These examples are extracted from open source projects.
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 Project: openjdk-jdk8u-backup File: XMouseDragGestureRecognizer.java License: 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; // 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()); }
Example 2
Source Project: jdk8u-jdk File: WMouseDragGestureRecognizer.java License: 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 Project: openjdk-jdk9 File: XToolkit.java License: 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 4
Source Project: jdk8u_jdk File: WMouseDragGestureRecognizer.java License: 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 5
Source Project: jdk8u_jdk File: XMouseDragGestureRecognizer.java License: 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; // 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()); }
Example 6
Source Project: hottub File: XMouseDragGestureRecognizer.java License: 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; // 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()); }
Example 7
Source Project: openjdk-jdk8u File: XToolkit.java License: 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 Project: openjdk-8 File: bug7170657.java License: GNU General Public License v2.0 | 5 votes |
private static void test(final Frame frame, final MouseEvent me) { MouseEvent newme = SwingUtilities.convertMouseEvent(frame, me, frame); if (me.getModifiersEx() != newme.getModifiersEx() || me.getModifiers() != newme.getModifiers()) { fail(me, newme); } }
Example 9
Source Project: freecol File: CanvasMouseMotionListener.java License: GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public void mouseDragged(MouseEvent me) { // getButton does not work here, TODO: find out why if ((me.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) != MouseEvent.BUTTON1_DOWN_MASK) return; performDragScrollIfActive(me); getGUI().updateGoto(me.getX(), me.getY(), true); }
Example 10
Source Project: jdk8u_jdk File: XToolkit.java License: GNU General Public License v2.0 | 5 votes |
static boolean isLeftMouseButton(MouseEvent me) { switch (me.getID()) { case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: return (me.getButton() == MouseEvent.BUTTON1); case MouseEvent.MOUSE_ENTERED: case MouseEvent.MOUSE_EXITED: case MouseEvent.MOUSE_CLICKED: case MouseEvent.MOUSE_DRAGGED: return ((me.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) != 0); } return false; }
Example 11
Source Project: jdk8u-dev-jdk File: XToolkit.java License: GNU General Public License v2.0 | 5 votes |
static boolean isLeftMouseButton(MouseEvent me) { switch (me.getID()) { case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: return (me.getButton() == MouseEvent.BUTTON1); case MouseEvent.MOUSE_ENTERED: case MouseEvent.MOUSE_EXITED: case MouseEvent.MOUSE_CLICKED: case MouseEvent.MOUSE_DRAGGED: return ((me.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) != 0); } return false; }
Example 12
Source Project: amodeus File: DefaultMapController.java License: GNU General Public License v2.0 | 5 votes |
@Override public void mouseDragged(MouseEvent e) { if (!movementEnabled || !isMoving) return; // Is only the selected mouse button pressed? if ((e.getModifiersEx() & MOUSE_BUTTONS_MASK) == movementMouseButtonMask || (isPlatformOsx() && e.getModifiersEx() == MAC_MOUSE_BUTTON3_MASK)) { Point p = e.getPoint(); if (lastDragPoint != null) { int diffx = lastDragPoint.x - p.x; int diffy = lastDragPoint.y - p.y; map.moveMap(diffx, diffy); } lastDragPoint = p; } }
Example 13
Source Project: hortonmachine File: SectorSelector.java License: GNU General Public License v3.0 | 5 votes |
public void mouseDragged(MouseEvent mouseEvent) { if (MouseEvent.BUTTON1_DOWN_MASK != mouseEvent.getModifiersEx()) return; if (this.getShape().isResizeable()) mouseEvent.consume(); // prevent view operations }
Example 14
Source Project: jdk8u_jdk File: bug7170657.java License: GNU General Public License v2.0 | 5 votes |
private static void test(final Frame frame, final MouseEvent me) { MouseEvent newme = SwingUtilities.convertMouseEvent(frame, me, frame); if (me.getModifiersEx() != newme.getModifiersEx() || me.getModifiers() != newme.getModifiers()) { fail(me, newme); } }
Example 15
Source Project: TencentKona-8 File: XToolkit.java License: GNU General Public License v2.0 | 5 votes |
static boolean isLeftMouseButton(MouseEvent me) { switch (me.getID()) { case MouseEvent.MOUSE_PRESSED: case MouseEvent.MOUSE_RELEASED: return (me.getButton() == MouseEvent.BUTTON1); case MouseEvent.MOUSE_ENTERED: case MouseEvent.MOUSE_EXITED: case MouseEvent.MOUSE_CLICKED: case MouseEvent.MOUSE_DRAGGED: return ((me.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) != 0); } return false; }
Example 16
Source Project: jpexs-decompiler File: LineMarkedEditorPane.java License: GNU General Public License v3.0 | 5 votes |
@Override public void mouseMoved(MouseEvent e) { ctrlDown = (e.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0; lastPos = e.getPoint(); update(); }
Example 17
Source Project: TencentKona-8 File: bug7170657.java License: GNU General Public License v2.0 | 5 votes |
private static void test(final Frame frame, final MouseEvent me) { MouseEvent newme = SwingUtilities.convertMouseEvent(frame, me, frame); if (me.getModifiersEx() != newme.getModifiersEx() || me.getModifiers() != newme.getModifiers()) { fail(me, newme); } }
Example 18
Source Project: openjdk-jdk8u File: bug7170657.java License: GNU General Public License v2.0 | 5 votes |
private static void test(final Frame frame, final MouseEvent me) { MouseEvent newme = SwingUtilities.convertMouseEvent(frame, me, frame); if (me.getModifiersEx() != newme.getModifiersEx() || me.getModifiers() != newme.getModifiers()) { fail(me, newme); } }
Example 19
Source Project: Logisim File: CanvasListener.java License: GNU General Public License v3.0 | 4 votes |
private boolean isButton1(MouseEvent e) { return (e.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) != 0; }
Example 20
Source Project: netbeans File: GlassPane.java License: Apache License 2.0 | 4 votes |
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; }