Java Code Examples for java.awt.event.MouseEvent#isMetaDown()
The following examples show how to use
java.awt.event.MouseEvent#isMetaDown() .
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: AMIDST File: MapViewer.java License: 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 Project: blog-codes File: mxGraphComponent.java License: 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 3
Source Project: marathonv5 File: RComponent.java License: 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 4
Source Project: audiveris File: UIPredicates.java License: 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 5
Source Project: megan-ce File: DataJTable.java License: 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 6
Source Project: consulo File: EditorTabbedContainer.java License: 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 Project: KodeBeagle File: ProjectTree.java License: 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 8
Source Project: consulo File: OnePixelDivider.java License: 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 9
Source Project: libreveris File: UIPredicates.java License: 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 10
Source Project: WorldPainter File: MouseOrTabletOperation.java License: 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 11
Source Project: netbeans File: JTreeTablePanel.java License: Apache License 2.0 | 4 votes |
private static boolean onlyShift(MouseEvent e) { return e.isShiftDown() && !(e.isAltDown() || e.isAltGraphDown() || e.isControlDown() || e.isMetaDown()); }
Example 12
Source Project: visualvm File: ProfilerTableContainer.java License: 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 13
Source Project: visualvm File: JTreeTablePanel.java License: 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 14
Source Project: amidst File: ViewerMouseListener.java License: GNU General Public License v3.0 | 4 votes |
@CalledOnlyBy(AmidstThread.EDT) private boolean isRightClick(MouseEvent e) { return e.isMetaDown(); }
Example 15
Source Project: consulo File: WideSelectionTreeUI.java License: 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 16
Source Project: amidst File: ViewerMouseListener.java License: GNU General Public License v3.0 | 4 votes |
@CalledOnlyBy(AmidstThread.EDT) private boolean isRightClick(MouseEvent e) { return e.isMetaDown(); }
Example 17
Source Project: Darcula File: DarculaTreeUI.java License: 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 Project: consulo File: XLineBreakpointManager.java License: 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 Project: audiveris File: UIPredicates.java License: 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 Project: libreveris File: UIPredicates.java License: 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(); } }