Java Code Examples for java.awt.event.MouseEvent#isMetaDown()
The following examples show how to use
java.awt.event.MouseEvent#isMetaDown() .
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: MapViewer.java From AMIDST with GNU General Public License v3.0 | 6 votes |
@Override public void mouseClicked(MouseEvent e) { if (!e.isMetaDown()) { Point mouse = e.getPoint(); // Don't use getMousePosition() because when computer is swapping/grinding, mouse may have moved out of window before execution reaches here. for (Widget widget : widgets) { if ((widget.isVisible()) && (mouse.x > widget.getX()) && (mouse.y > widget.getY()) && (mouse.x < widget.getX() + widget.getWidth()) && (mouse.y < widget.getY() + widget.getHeight())) { if (widget.onClick(mouse.x - widget.getX(), mouse.y - widget.getY())) return; } } MapObject object = worldMap.getObjectAt(mouse, 50.0); if (selectedObject != null) selectedObject.localScale = 1.0; if (object != null) object.localScale = 1.5; selectedObject = object; } }
Example 2
Source File: RComponent.java From marathonv5 with Apache License 2.0 | 5 votes |
protected void mousePressed(MouseEvent me) { if (me.getButton() == MouseEvent.BUTTON1 && me.getClickCount() == 1 && !me.isAltDown() && !me.isMetaDown() && !me.isAltGraphDown() && !me.isControlDown()) { mouseButton1Pressed(me); } else { recorder.recordClick2(this, me, true); } }
Example 3
Source File: UIPredicates.java From libreveris with GNU Lesser General Public License v3.0 | 5 votes |
/** * Predicate to check if an additional selection is wanted. * Default is the typical selection (left button), while control key is * pressed. * * @param e the mouse context * @return the predicate result */ public static boolean isAdditionWanted (MouseEvent e) { if (WellKnowns.MAC_OS_X) { boolean command = e.isMetaDown(); boolean left = SwingUtilities.isLeftMouseButton(e); return left && command && !e.isPopupTrigger(); } else { return (SwingUtilities.isRightMouseButton(e) != SwingUtilities.isLeftMouseButton( e)) && e.isControlDown(); } }
Example 4
Source File: OnePixelDivider.java From consulo with Apache License 2.0 | 5 votes |
@Override protected void processMouseEvent(MouseEvent e) { super.processMouseEvent(e); if (e.getID() == MouseEvent.MOUSE_CLICKED) { if (mySwitchOrientationEnabled && e.getClickCount() == 1 && SwingUtilities.isLeftMouseButton(e) && (SystemInfo.isMac ? e.isMetaDown() : e.isControlDown())) { mySplitter.setOrientation(!mySplitter.getOrientation()); } if (myResizeEnabled && e.getClickCount() == 2) { mySplitter.setProportion(.5f); } } }
Example 5
Source File: ProjectTree.java From KodeBeagle with Apache License 2.0 | 5 votes |
public final MouseListener getMouseListener(final TreeNode root) { return new MouseAdapter() { @Override public void mouseClicked(final MouseEvent mouseEvent) { DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) windowObjects.getjTree().getLastSelectedPathComponent(); String url = ""; if (mouseEvent.isMetaDown() && selectedNode != null && selectedNode.getParent() != null) { final String gitUrl = getGitUrl(selectedNode, url, root); JPopupMenu menu = new JPopupMenu(); if (selectedNode.isLeaf()) { final CodeInfo codeInfo = (CodeInfo) selectedNode.getUserObject(); menu.add(new JMenuItem(addOpenInNewTabMenuItem(codeInfo))). setText(OPEN_IN_NEW_TAB); } menu.add(new JMenuItem(new AbstractAction() { @Override public void actionPerformed(final ActionEvent actionEvent) { if (!gitUrl.isEmpty()) { BrowserUtil.browse(GITHUB_LINK + gitUrl); } } })).setText(RIGHT_CLICK_MENU_ITEM_TEXT); menu.show(mouseEvent.getComponent(), mouseEvent.getX(), mouseEvent.getY()); } doubleClickListener(mouseEvent); } }; }
Example 6
Source File: EditorTabbedContainer.java From consulo with Apache License 2.0 | 5 votes |
@Override public void mouseClicked(MouseEvent e) { if (UIUtil.isActionClick(e, MouseEvent.MOUSE_CLICKED) && (e.isMetaDown() || !SystemInfo.isMac && e.isControlDown())) { final TabInfo info = myTabs.findInfo(e); if (info != null && info.getObject() != null) { final VirtualFile vFile = (VirtualFile)info.getObject(); if (vFile != null) { ShowFilePathAction.show(vFile, e); } } } }
Example 7
Source File: DataJTable.java From megan-ce with GNU General Public License v3.0 | 5 votes |
public void mousePressed(MouseEvent e) { if (e.isPopupTrigger()) { showPopupMenu(e); } else { if (e.getSource() instanceof JTableHeader) { columnPressed = jTable.getTableHeader().columnAtPoint(e.getPoint()); if (columnPressed >= 0) { if (!e.isShiftDown() && !e.isMetaDown()) clearSelection(); selectColumn(columnPressed, true); } } } }
Example 8
Source File: UIPredicates.java From audiveris with GNU Affero General Public License v3.0 | 5 votes |
/** * Predicate to check if an additional selection is wanted. * Default is the typical selection (left button), while control key is pressed. * * @param e the mouse context * @return the predicate result */ public static boolean isAdditionWanted (MouseEvent e) { if (WellKnowns.MAC_OS_X) { boolean command = e.isMetaDown(); boolean left = SwingUtilities.isLeftMouseButton(e); return left && command && !e.isPopupTrigger(); } else { return (SwingUtilities.isRightMouseButton(e) != SwingUtilities.isLeftMouseButton(e)) && e.isControlDown(); } }
Example 9
Source File: mxGraphComponent.java From blog-codes with Apache License 2.0 | 5 votes |
/** * * @param event * @return Returns true if the given event should toggle selected cells. */ public boolean isToggleEvent(MouseEvent event) { // NOTE: IsMetaDown always returns true for right-clicks on the Mac, so // toggle selection for left mouse buttons requires CMD key to be pressed, // but toggle for right mouse buttons requires CTRL to be pressed. return (event != null) ? ((mxUtils.IS_MAC) ? ((SwingUtilities .isLeftMouseButton(event) && event.isMetaDown()) || (SwingUtilities .isRightMouseButton(event) && event.isControlDown())) : event.isControlDown()) : false; }
Example 10
Source File: JTreeTablePanel.java From visualvm with GNU General Public License v2.0 | 4 votes |
private static boolean onlyShift(MouseEvent e) { return e.isShiftDown() && !(e.isAltDown() || e.isAltGraphDown() || e.isControlDown() || e.isMetaDown()); }
Example 11
Source File: ProfilerTableContainer.java From visualvm with GNU General Public License v2.0 | 4 votes |
private static boolean onlyShift(MouseEvent e) { return e.isShiftDown() && !(e.isAltDown() || e.isAltGraphDown() || e.isControlDown() || e.isMetaDown()); }
Example 12
Source File: ViewerMouseListener.java From amidst with GNU General Public License v3.0 | 4 votes |
@CalledOnlyBy(AmidstThread.EDT) private boolean isRightClick(MouseEvent e) { return e.isMetaDown(); }
Example 13
Source File: WideSelectionTreeUI.java From consulo with Apache License 2.0 | 4 votes |
@Override protected boolean isToggleSelectionEvent(MouseEvent e) { return SwingUtilities.isLeftMouseButton(e) && (SystemInfo.isMac ? e.isMetaDown() : e.isControlDown()) && !e.isPopupTrigger(); }
Example 14
Source File: ViewerMouseListener.java From amidst with GNU General Public License v3.0 | 4 votes |
@CalledOnlyBy(AmidstThread.EDT) private boolean isRightClick(MouseEvent e) { return e.isMetaDown(); }
Example 15
Source File: JTreeTablePanel.java From netbeans with Apache License 2.0 | 4 votes |
private static boolean onlyShift(MouseEvent e) { return e.isShiftDown() && !(e.isAltDown() || e.isAltGraphDown() || e.isControlDown() || e.isMetaDown()); }
Example 16
Source File: MouseOrTabletOperation.java From WorldPainter with GNU General Public License v3.0 | 4 votes |
@Override public void mousePressed(MouseEvent me) { if ((me.getButton() != BUTTON1) && (me.getButton() != BUTTON3)) { // Only interested in left and right mouse buttons // TODO: the right mouse button is not button three on two-button // mice, is it? return; } x = me.getX(); y = me.getY(); altDown = me.isAltDown() || me.isAltGraphDown(); undo = (me.getButton() == BUTTON3) || altDown; ctrlDown = me.isControlDown() || me.isMetaDown(); shiftDown = me.isShiftDown(); first = true; if (! oneShot) { interrupt(); // Make sure any operation in progress (due to timing issues perhaps) is interrupted timer = new Timer(delay, e -> { Point worldCoords = view.viewToWorld((int) x, (int) y); tick(worldCoords.x, worldCoords.y, undo, first, 1.0f); view.updateStatusBar(worldCoords.x, worldCoords.y); first = false; }); timer.setInitialDelay(0); timer.start(); operationStartedWithButton = me.getButton(); App.getInstance().pauseAutosave(); // start = System.currentTimeMillis(); } else { Point worldCoords = view.viewToWorld((int) x, (int) y); App.getInstance().pauseAutosave(); try { tick(worldCoords.x, worldCoords.y, undo, true, 1.0f); view.updateStatusBar(worldCoords.x, worldCoords.y); Dimension dimension = getDimension(); if (dimension != null) { dimension.armSavePoint(); } logOperation(undo ? statisticsKeyUndo : statisticsKey); } finally { App.getInstance().resumeAutosave(); } } me.consume(); }
Example 17
Source File: DarculaTreeUI.java From Darcula with Apache License 2.0 | 4 votes |
@Override protected boolean isToggleSelectionEvent(MouseEvent e) { return SwingUtilities.isLeftMouseButton(e) && (SystemInfo.isMac ? e.isMetaDown() : e.isControlDown()) && !e.isPopupTrigger(); }
Example 18
Source File: XLineBreakpointManager.java From consulo with Apache License 2.0 | 4 votes |
@Override public void mouseClicked(final EditorMouseEvent e) { final Editor editor = e.getEditor(); final MouseEvent mouseEvent = e.getMouseEvent(); if (mouseEvent.isPopupTrigger() || mouseEvent.isMetaDown() || mouseEvent.isControlDown() || mouseEvent.getButton() != MouseEvent.BUTTON1 || DiffUtil.isDiffEditor(editor) || !isInsideGutter(e, editor) || ConsoleViewUtil.isConsoleViewEditor(editor) || !isFromMyProject(editor) || (editor.getSelectionModel().hasSelection() && myDragDetected)) { return; } PsiDocumentManager.getInstance(myProject).commitAllDocuments(); final int line = EditorUtil.yPositionToLogicalLine(editor, mouseEvent); final Document document = editor.getDocument(); final VirtualFile file = FileDocumentManager.getInstance().getFile(document); if (line >= 0 && line < document.getLineCount() && file != null) { ActionManagerEx.getInstanceEx().fireBeforeActionPerformed(IdeActions.ACTION_TOGGLE_LINE_BREAKPOINT, e.getMouseEvent()); final AsyncResult<XLineBreakpoint> lineBreakpoint = XBreakpointUtil.toggleLineBreakpoint(myProject, XSourcePositionImpl.create(file, line), editor, mouseEvent.isAltDown(), false); lineBreakpoint.doWhenDone(breakpoint -> { if (!mouseEvent.isAltDown() && mouseEvent.isShiftDown() && breakpoint != null) { breakpoint.setSuspendPolicy(SuspendPolicy.NONE); String selection = editor.getSelectionModel().getSelectedText(); if (selection != null) { breakpoint.setLogExpression(selection); } else { breakpoint.setLogMessage(true); } // edit breakpoint DebuggerUIUtil.showXBreakpointEditorBalloon(myProject, mouseEvent.getPoint(), ((EditorEx)editor).getGutterComponentEx(), false, breakpoint); } }); } }
Example 19
Source File: UIPredicates.java From audiveris with GNU Affero General Public License v3.0 | 3 votes |
/** * Predicate to check if the display should be rezoomed to fit as * close as possible to the rubber definition. * Default is to have both Shift and Control keys pressed when the mouse is * released. * * @param e the mouse context * @return the predicate result */ public static boolean isRezoomWanted (MouseEvent e) { if (WellKnowns.MAC_OS_X) { return e.isMetaDown() && e.isShiftDown(); } else { return e.isControlDown() && e.isShiftDown(); } }
Example 20
Source File: UIPredicates.java From libreveris with GNU Lesser General Public License v3.0 | 3 votes |
/** * Predicate to check if the display should be rezoomed to fit as * close as possible to the rubber definition. * Default is to have both Shift and Control keys pressed when the mouse is * released. * * @param e the mouse context * @return the predicate result */ public static boolean isRezoomWanted (MouseEvent e) { if (WellKnowns.MAC_OS_X) { return e.isMetaDown() && e.isShiftDown(); } else { return e.isControlDown() && e.isShiftDown(); } }