List of usage examples for javafx.scene.input MouseEvent isMetaDown
public final boolean isMetaDown()
From source file:Main.java
private static int modifiers(final InputEvent event) { if (event instanceof MouseEvent) { final MouseEvent mouseEvent = (MouseEvent) event; int modifiers = 0; if (mouseEvent.isAltDown()) { modifiers |= java.awt.event.MouseEvent.ALT_MASK; modifiers |= java.awt.event.MouseEvent.ALT_DOWN_MASK; }/*from w w w . j av a 2s . com*/ if (mouseEvent.isControlDown()) { modifiers |= java.awt.event.MouseEvent.CTRL_MASK; modifiers |= java.awt.event.MouseEvent.CTRL_DOWN_MASK; } if (mouseEvent.isMetaDown()) { modifiers |= java.awt.event.MouseEvent.META_MASK; modifiers |= java.awt.event.MouseEvent.META_DOWN_MASK; } if (mouseEvent.isShiftDown()) { modifiers |= java.awt.event.MouseEvent.SHIFT_MASK; modifiers |= java.awt.event.MouseEvent.SHIFT_DOWN_MASK; } if (mouseEvent.isPrimaryButtonDown()) { modifiers |= java.awt.event.MouseEvent.BUTTON1_MASK; } if (mouseEvent.isMiddleButtonDown()) { modifiers |= java.awt.event.MouseEvent.BUTTON2_MASK; } if (mouseEvent.isSecondaryButtonDown()) { modifiers |= java.awt.event.MouseEvent.BUTTON3_MASK; } return modifiers; } if (event instanceof KeyEvent) { final KeyEvent keyEvent = (KeyEvent) event; int modifiers = 0; if (keyEvent.isAltDown()) { modifiers |= java.awt.event.KeyEvent.ALT_MASK; } if (keyEvent.isControlDown()) { modifiers |= java.awt.event.KeyEvent.CTRL_MASK; } if (keyEvent.isMetaDown()) { modifiers |= java.awt.event.KeyEvent.META_MASK; } if (keyEvent.isShiftDown()) { modifiers |= java.awt.event.KeyEvent.SHIFT_MASK; } return modifiers; } return 0; }
From source file:de.hs.mannheim.modUro.controller.diagram.fx.interaction.AbstractMouseHandlerFX.java
/** * Returns <code>true</code> if the specified mouse event has modifier * keys that match this handler./*from w ww. jav a2s.c o m*/ * * @param e the mouse event (<code>null</code> not permitted). * * @return A boolean. */ @Override public boolean hasMatchingModifiers(MouseEvent e) { boolean b = true; b = b && (this.altKey == e.isAltDown()); b = b && (this.ctrlKey == e.isControlDown()); b = b && (this.metaKey == e.isMetaDown()); b = b && (this.shiftKey == e.isShiftDown()); return b; }
From source file:Main.java
public static java.awt.event.MouseEvent toAwt(final MouseEvent event) { final EventType type = event.getEventType(); if (null == type) { return null; }// w w w. ja v a2s. c o m final int id; if (MouseEvent.MOUSE_MOVED.equals(type)) { id = java.awt.event.MouseEvent.MOUSE_MOVED; } else if (MouseEvent.MOUSE_DRAGGED.equals(type)) { id = java.awt.event.MouseEvent.MOUSE_DRAGGED; } else if (MouseEvent.MOUSE_CLICKED.equals(type)) { id = java.awt.event.MouseEvent.MOUSE_CLICKED; } else if (MouseEvent.MOUSE_PRESSED.equals(type)) { id = java.awt.event.MouseEvent.MOUSE_PRESSED; } else if (MouseEvent.MOUSE_RELEASED.equals(type)) { id = java.awt.event.MouseEvent.MOUSE_RELEASED; } else if (MouseEvent.MOUSE_ENTERED.equals(type)) { id = java.awt.event.MouseEvent.MOUSE_ENTERED; } else if (MouseEvent.MOUSE_EXITED.equals(type)) { id = java.awt.event.MouseEvent.MOUSE_EXITED; } else { return null; } final int button; if (event.isPrimaryButtonDown()) { button = java.awt.event.MouseEvent.BUTTON1; } else if (event.isMiddleButtonDown()) { button = java.awt.event.MouseEvent.BUTTON2; } else if (event.isSecondaryButtonDown()) { button = java.awt.event.MouseEvent.BUTTON3; } else { button = java.awt.event.MouseEvent.NOBUTTON; } final long when = -1; final int modifiers = modifiers(event); final int x = (int) event.getX(); final int y = (int) event.getY(); final int xAbs = Integer.MAX_VALUE; final int yAbs = Integer.MAX_VALUE; final int count = event.getClickCount(); boolean popup = event.isPopupTrigger(); if (MouseEvent.MOUSE_CLICKED.equals(type) && event.isMetaDown()) { // mack books use meta flag for right-clicks popup = true; } return new java.awt.event.MouseEvent(empty, id, when, modifiers, x, y, xAbs, yAbs, count, popup, button); }