Java Code Examples for javafx.scene.input.MouseEvent#isShiftDown()
The following examples show how to use
javafx.scene.input.MouseEvent#isShiftDown() .
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: PageActionModifier.java From Open-Lowcode with Eclipse Public License 2.0 | 6 votes |
/** * @param event a mouse event * @return true if the mouse event corresponds to the modifier */ public boolean isActionWithModifier(MouseEvent event) { if (event.getClickCount()==1) { boolean modifier = false; if (event.isControlDown()) { modifier = true; if (type == TYPE_CTRLPRESSED) return true; } if (event.isShiftDown()) { modifier =true; if (type == TYPE_SHIFTPRESSED) return true; } if (!modifier) { if (type == TYPE_NOTHINGPRESSED) return true; } } return false; }
Example 2
Source File: ParetoPanel.java From charts with Apache License 2.0 | 6 votes |
/** * Handles the clicks on DataDots and ParetoBars * @param EVT */ private void handleMouseEvents(final MouseEvent EVT) { final EventType<? extends MouseEvent> TYPE = EVT.getEventType(); double X = EVT.getX(); double Y = EVT.getY(); if(MouseEvent.MOUSE_PRESSED.equals(TYPE)) { for (DataDot dot: dataDots) { if(insideDataDot(X,Y,dot)) { showPopup(EVT.getScreenX(),EVT.getScreenY(),dot); return; } } for(ParetoBar bar: paretoModel.getData()) { if(insideBar(X,Y,bar)) { if(EVT.isShiftDown()){ filterChartByBar(bar); }else { cascadeIntoBar(bar); } break; } } } }
Example 3
Source File: WSRecorder.java From marathonv5 with Apache License 2.0 | 6 votes |
private String buildModifiersText(MouseEvent e) { StringBuilder sb = new StringBuilder(); if (e.isAltDown()) { sb.append("Alt+"); } if (e.isControlDown()) { sb.append("Ctrl+"); } if (e.isMetaDown()) { sb.append("Meta+"); } if (e.isShiftDown()) { sb.append("Shift+"); } if (sb.length() > 0) { sb.setLength(sb.length() - 1); } String mtext = sb.toString(); return mtext; }
Example 4
Source File: CObjectArray.java From Open-Lowcode with Eclipse Public License 2.0 | 5 votes |
@Override public void handle(MouseEvent mouseevent) { logger.fine(" ----> Mouse Event detected inside Object array "); // only transmit click if double click, single click stays local if (!mouseevent.isShiftDown()) if (mouseevent.getClickCount()>1) if (isregisteredaction) if (thisobjectarray.thistable.getSelectionModel().getSelectedItem() != null) { logger.severe(" --> launching handling of event"); actionmanager.getMouseHandler().handle(mouseevent); } else { logger.severe(" --> handling of event discarded as no item selected"); } }
Example 5
Source File: AbstractMouseHandlerFX.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Returns <code>true</code> if the specified mouse event has modifier * keys that match this handler. * * @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; }
Example 6
Source File: TaAbstractMouseHandlerFX.java From TAcharting with GNU Lesser General Public License v2.1 | 5 votes |
/** * Returns {@code true} if the specified mouse event has modifier * keys that match this handler. * * @param e the mouse event ({@code null} 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; }
Example 7
Source File: AbstractMouseHandlerFX.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Returns <code>true</code> if the specified mouse event has modifier * keys that match this handler. * * @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; }
Example 8
Source File: AbstractMouseHandlerFX.java From jfreechart-fx with GNU Lesser General Public License v2.1 | 5 votes |
/** * Returns {@code true} if the specified mouse event has modifier * keys that match this handler. * * @param e the mouse event ({@code null} 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; }
Example 9
Source File: JavaFxRecorderHook.java From marathonv5 with Apache License 2.0 | 5 votes |
public static String mouseEventGetModifiersExText(MouseEvent event) { StringBuffer sb = new StringBuffer(); if (event.isControlDown()) { sb.append("Ctrl+"); } if (event.isMetaDown()) { sb.append("Meta+"); } if (event.isAltDown()) { sb.append("Alt+"); } if (event.isShiftDown()) { sb.append("Shift+"); } if (event.isPrimaryButtonDown()) { sb.append("Button1+"); } if (event.isMiddleButtonDown()) { sb.append("Button2+"); } if (event.isSecondaryButtonDown()) { sb.append("Button3+"); } String text = sb.toString(); if (text.equals("")) { return text; } return text.substring(0, text.length() - 1); }
Example 10
Source File: FX.java From FxDock with Apache License 2.0 | 5 votes |
/** sometimes MouseEvent.isPopupTrigger() is not enough */ public static boolean isPopupTrigger(MouseEvent ev) { if(ev.getButton() == MouseButton.SECONDARY) { if(CPlatform.isMac()) { if ( !ev.isAltDown() && !ev.isMetaDown() && !ev.isShiftDown() ) { return true; } } else { if ( !ev.isAltDown() && !ev.isControlDown() && !ev.isMetaDown() && !ev.isShiftDown() ) { return true; } } } return false; }
Example 11
Source File: OSFXUtils.java From marathonv5 with Apache License 2.0 | 5 votes |
public static String mouseEventGetModifiersExText(MouseEvent event) { StringBuffer sb = new StringBuffer(); if (event.isControlDown()) { sb.append("Ctrl+"); } if (event.isMetaDown()) { sb.append("Meta+"); } if (event.isAltDown()) { sb.append("Alt+"); } if (event.isShiftDown()) { sb.append("Shift+"); } if (event.isPrimaryButtonDown()) { sb.append("Button1+"); } if (event.isMiddleButtonDown()) { sb.append("Button2+"); } if (event.isSecondaryButtonDown()) { sb.append("Button3+"); } String text = sb.toString(); if (text.equals("")) { return text; } return text.substring(0, text.length() - 1); }
Example 12
Source File: WebViewEventDispatcher.java From oim-fx with MIT License | 5 votes |
private void processMouseEvent(MouseEvent ev) { if (page == null) { return; } // RT-24511 EventType<? extends MouseEvent> type = ev.getEventType(); double x = ev.getX(); double y = ev.getY(); double screenX = ev.getScreenX(); double screenY = ev.getScreenY(); if (type == MouseEvent.MOUSE_EXITED) { type = MouseEvent.MOUSE_MOVED; x = Short.MIN_VALUE; y = Short.MIN_VALUE; Point2D screenPoint = webView.localToScreen(x, y); if (screenPoint == null) { return; } screenX = screenPoint.getX(); screenY = screenPoint.getY(); } final Integer id = idMap.get(type); if (id == null) { // not supported by webkit return; } WCMouseEvent mouseEvent = new WCMouseEvent(id, idMap.get(ev.getButton()), ev.getClickCount(), (int) x, (int) y, (int) screenX, (int) screenY, System.currentTimeMillis(), ev.isShiftDown(), ev.isControlDown(), ev.isAltDown(), ev.isMetaDown(), ev.isPopupTrigger()); page.dispatchMouseEvent(mouseEvent); ev.consume(); }
Example 13
Source File: AbstractMouseHandlerFX.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * Returns <code>true</code> if the specified mouse event has modifier * keys that match this handler. * * @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; }
Example 14
Source File: AbstractMouseHandlerFX.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Returns <code>true</code> if the specified mouse event has modifier * keys that match this handler. * * @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; }
Example 15
Source File: CObjectArray.java From Open-Lowcode with Eclipse Public License 2.0 | 5 votes |
@Override public void handle(MouseEvent event) { MouseButton button = event.getButton(); if (button == MouseButton.PRIMARY) { if (event.getClickCount() == 1 && (!event.isShiftDown())) { if (thisobjectarray.thistable.getEditingCell() == null) { @SuppressWarnings("unchecked") TablePosition< ObjectTableRow, ?> focusedCellPosition = thisobjectarray.thistable.getFocusModel().getFocusedCell(); thisobjectarray.thistable.edit(focusedCellPosition.getRow(), focusedCellPosition.getTableColumn()); } } // checking that something is actually selecting when double-clicking. if (event.getClickCount() > 1) if (thisobjectarray.thistable.getSelectionModel().getSelectedItem() != null) { // trigger the action on double click only if updatemode is not active if (!thisobjectarray.updatemodeactive) { mouseeventlistener.handle(event); } } } else { } }
Example 16
Source File: DragSupport.java From scenic-view with GNU General Public License v3.0 | 4 votes |
private boolean isModifierCorrect(MouseEvent t, KeyCode keyCode) { return (keyCode != KeyCode.ALT ^ t.isAltDown()) && (keyCode != KeyCode.CONTROL ^ t.isControlDown()) && (keyCode != KeyCode.SHIFT ^ t.isShiftDown()) && (keyCode != KeyCode.META ^ t.isMetaDown()); }
Example 17
Source File: MouseEventsHelper.java From chart-fx with Apache License 2.0 | 4 votes |
public static boolean modifierKeysUp(final MouseEvent event) { return !event.isAltDown() && !event.isControlDown() && !event.isMetaDown() && !event.isShiftDown(); }
Example 18
Source File: MouseEventsHelper.java From chart-fx with Apache License 2.0 | 4 votes |
public static boolean isOnlyCtrlModifierDown(final MouseEvent event) { return event.isControlDown() && !event.isAltDown() && !event.isMetaDown() && !event.isShiftDown(); }
Example 19
Source File: CreateCurveOnDragHandler.java From gef with Eclipse Public License 2.0 | 4 votes |
@Override public void startDrag(MouseEvent event) { // create new curve GeometricCurve curve = new GeometricCurve(new Point[] { new Point(), new Point() }, MvcLogoExample.GEF_COLOR_GREEN, MvcLogoExample.GEF_STROKE_WIDTH, MvcLogoExample.GEF_DASH_PATTERN, null); curve.addSourceAnchorage(getShapePart().getContent()); // create using CreationPolicy from root part CreationPolicy creationPolicy = getHost().getRoot().getAdapter(CreationPolicy.class); init(creationPolicy); curvePart = (GeometricCurvePart) creationPolicy.create(curve, getHost().getRoot(), HashMultimap.<IContentPart<? extends Node>, String> create()); commit(creationPolicy); // disable refresh visuals for the curvePart storeAndDisableRefreshVisuals(curvePart); // move curve to pointer location curvePart.getVisual().setEndPoint(getLocation(event)); // build operation to deselect all but the new curve part List<IContentPart<? extends Node>> toBeDeselected = new ArrayList<>( getHost().getRoot().getViewer().getAdapter(SelectionModel.class).getSelectionUnmodifiable()); toBeDeselected.remove(curvePart); DeselectOperation deselectOperation = new DeselectOperation(getHost().getRoot().getViewer(), toBeDeselected); // execute on stack try { getHost().getRoot().getViewer().getDomain().execute(deselectOperation, new NullProgressMonitor()); } catch (ExecutionException e) { throw new RuntimeException(e); } // find bend target part bendTargetPart = findBendTargetPart(curvePart, event.getTarget()); if (bendTargetPart != null) { dragPolicies = bendTargetPart.getAdapters(ClickDragGesture.ON_DRAG_POLICY_KEY); } if (dragPolicies != null) { MouseEvent dragEvent = new MouseEvent(event.getSource(), event.getTarget(), MouseEvent.MOUSE_DRAGGED, event.getX(), event.getY(), event.getScreenX(), event.getScreenY(), event.getButton(), event.getClickCount(), event.isShiftDown(), event.isControlDown(), event.isAltDown(), event.isMetaDown(), event.isPrimaryButtonDown(), event.isMiddleButtonDown(), event.isSecondaryButtonDown(), event.isSynthesized(), event.isPopupTrigger(), event.isStillSincePress(), event.getPickResult()); for (IOnDragHandler dragPolicy : dragPolicies.values()) { dragPolicy.startDrag(event); // XXX: send initial drag event so that the end position is set dragPolicy.drag(dragEvent, new Dimension()); } } }
Example 20
Source File: CloneOnClickHandler.java From gef with Eclipse Public License 2.0 | 4 votes |
protected boolean isCloneModifierDown(MouseEvent e) { return e.isAltDown() || e.isShiftDown(); }