Java Code Examples for java.awt.event.MouseEvent#consume()
The following examples show how to use
java.awt.event.MouseEvent#consume() .
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: mxVertexHandler.java From blog-codes with Apache License 2.0 | 6 votes |
/** * */ public void mouseReleased(MouseEvent e) { if (!e.isConsumed() && first != null) { if (preview != null && preview.isVisible()) { if (isLabel(index)) { moveLabel(e); } else { resizeCell(e); } } e.consume(); } super.mouseReleased(e); }
Example 2
Source File: MouseSmoothingShapeCreationUI.java From pumpernickel with MIT License | 6 votes |
@Override public void mousePressed(MouseEvent e) { try { ShapeCreationPanel scp = (ShapeCreationPanel) e.getComponent(); scp.requestFocus(); boolean isCreating = ShapeCreationPanel.MODE_CREATE.equals(scp .getMode()); if (e.getClickCount() > 1 && isCreating) { int i = scp.getDataModel().getShapeCount() - 1; scp.getDataModel().removeShape(i); scp.setMode(ShapeCreationPanel.MODE_DEFAULT); e.consume(); return; } if (isCreating) { v = new BasicMouseSmoothing(); addPoint(v, e, true); } else { Selection selection = getSelectedShape(scp, e.getPoint()); scp.getSelectionModel().select(selection); } } finally { lastUntransformedX = e.getX(); lastUntransformedY = e.getY(); } }
Example 3
Source File: DrawTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public void mousePressed(MouseEvent e) { e.consume(); switch (mode) { case LINES: x1 = e.getX(); y1 = e.getY(); x2 = -1; break; case POINTS: default: colors.add(getForeground()); lines.add(new Rectangle(e.getX(), e.getY(), -1, -1)); x1 = e.getX(); y1 = e.getY(); repaint(); break; } }
Example 4
Source File: InspectorTreeMouseListener.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void mouseClicked(MouseEvent event) { final DefaultMutableTreeNode node = getClosestTreeNode(event); // TODO(jacobr): support clicking on a property. // It would be reasonable for that to trigger selecting the parent of the // property. final DiagnosticsNode diagnostic = TreeUtils.maybeGetDiagnostic(node); if (diagnostic != null && !diagnostic.isProperty()) { // A double click triggers forcing changing the subtree root. if (event.getClickCount() == 2) { if (panel.isSummaryTree) { panel.applyNewSelection(diagnostic, diagnostic, true, false); } else if (panel.parentTree != null) { panel.parentTree.applyNewSelection( panel.firstAncestorInParentTree(node), diagnostic, true, false); } } } event.consume(); }
Example 5
Source File: DrawTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Override public void mouseDragged(MouseEvent e) { e.consume(); switch (mode) { case LINES: x2 = e.getX(); y2 = e.getY(); break; case POINTS: default: colors.add(getForeground()); lines.add(new Rectangle(x1, y1, e.getX(), e.getY())); x1 = e.getX(); y1 = e.getY(); break; } repaint(); }
Example 6
Source File: Grid.java From Forsythia with GNU General Public License v3.0 | 6 votes |
public void mouseReleased(MouseEvent e){ int b=e.getButton(),x=e.getX(),y=e.getY(); if(b==MouseEvent.BUTTON1&&!e.isConsumed()){ //center and fit on left doubleclick if(e.getClickCount()==2) { e.consume(); centerAndFit(); repaint(); return;} int dx=x-mousedownx,dy=y-mousedowny; boolean shift=e.isShiftDown(); if(Math.abs(dx)<MINDRAGDIST&&Math.abs(dy)<MINDRAGDIST&&!shift){ doMouseTouch(x,y); }else{ if(shift){ doMouseZoom(dy); }else{ doMousePan(dx,dy);}}}}
Example 7
Source File: DrawTest.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override public void mousePressed(MouseEvent e) { e.consume(); switch (mode) { case LINES: x1 = e.getX(); y1 = e.getY(); x2 = -1; break; case POINTS: default: colors.add(getForeground()); lines.add(new Rectangle(e.getX(), e.getY(), -1, -1)); x1 = e.getX(); y1 = e.getY(); repaint(); break; } }
Example 8
Source File: EditorActionUtil.java From consulo with Apache License 2.0 | 5 votes |
private static void showEditorPopup(final EditorMouseEvent event, @Nonnull final ActionGroup group) { if (!event.isConsumed() && event.getArea() == EditorMouseEventArea.EDITING_AREA) { ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.EDITOR_POPUP, group); MouseEvent e = event.getMouseEvent(); final Component c = e.getComponent(); if (c != null && c.isShowing()) { popupMenu.getComponent().show(c, e.getX(), e.getY()); } e.consume(); } }
Example 9
Source File: ButtonPopupSwitcher.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void mousePressed(MouseEvent e) { int tabCount = displayer.getModel().size(); if( pTable.onMouseEvent(e) && tabCount == 1 ) { hideCurrentPopup(); } e.consume(); }
Example 10
Source File: DrawTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public void mouseReleased(MouseEvent e) { e.consume(); switch (mode) { case LINES: colors.add(getForeground()); lines.add(new Rectangle(x1, y1, e.getX(), e.getY())); x2 = -1; break; case POINTS: default: break; } repaint(); }
Example 11
Source File: MouseHandler.java From rscplus with GNU General Public License v3.0 | 5 votes |
@Override public void mousePressed(MouseEvent e) { if (inConsumableButton()) { e.consume(); } if (listener_mouse == null) return; if (Replay.isRecording) { Replay.dumpMouseInput( Replay.MOUSE_PRESSED, e.getX(), e.getY(), 0, e.getModifiers(), e.getClickCount(), 0, 0, e.isPopupTrigger(), e.getButton()); } if (e.getButton() == MouseEvent.BUTTON2) { m_rotating = true; m_rotatePosition = e.getPoint(); e.consume(); } if (!e.isConsumed()) { x = e.getX(); y = e.getY(); listener_mouse.mousePressed(e); } mouseClicked = true; }
Example 12
Source File: mxGraphHandler.java From blog-codes with Apache License 2.0 | 5 votes |
/** * */ public void mousePressed(MouseEvent e) { if (graphComponent.isEnabled() && isEnabled() && !e.isConsumed() && !graphComponent.isForceMarqueeEvent(e)) { cell = graphComponent.getCellAt(e.getX(), e.getY(), false); initialCell = cell; if (cell != null) { if (isSelectEnabled() && !graphComponent.getGraph().isCellSelected(cell)) { graphComponent.selectCellForEvent(cell, e); cell = null; } // Starts move if the cell under the mouse is movable and/or any // cells of the selection are movable if (isMoveEnabled() && !e.isPopupTrigger()) { start(e); e.consume(); } } else if (e.isPopupTrigger()) { graphComponent.getGraph().clearSelection(); } } }
Example 13
Source File: AddressBookPanel.java From zencash-swing-wallet-ui with MIT License | 5 votes |
@Override public void mousePressed(MouseEvent e) { if (e.isConsumed() || (!e.isPopupTrigger())) return; int row = table.rowAtPoint(e.getPoint()); int column = table.columnAtPoint(e.getPoint()); table.changeSelection(row, column, false, false); AddressBookEntry entry = entries.get(row); JPopupMenu menu = new JPopupMenu(); JMenuItem sendCash = new JMenuItem(langUtil.getString("panel.address.book.menuitem.sendcash.text", entry.name)); sendCash.addActionListener(new SendCashActionListener()); menu.add(sendCash); JMenuItem copyAddress = new JMenuItem(langUtil.getString("panel.address.book.menuitem.copy.address.text")); copyAddress.addActionListener(new CopyToClipboardActionListener()); menu.add(copyAddress); JMenuItem deleteEntry = new JMenuItem(langUtil.getString("panel.address.book.menuitem.delete.entry.text", entry.name)); deleteEntry.addActionListener(new DeleteAddressActionListener()); menu.add(deleteEntry); menu.show(e.getComponent(), e.getPoint().x, e.getPoint().y); e.consume(); }
Example 14
Source File: CoverageLineMarkerRenderer.java From consulo with Apache License 2.0 | 5 votes |
public void doAction(final Editor editor, final MouseEvent e) { e.consume(); final JComponent comp = (JComponent)e.getComponent(); final JRootPane rootPane = comp.getRootPane(); final JLayeredPane layeredPane = rootPane.getLayeredPane(); final Point point = SwingUtilities.convertPoint(comp, THICKNESS, e.getY(), layeredPane); showHint(editor, point, editor.xyToLogicalPosition(e.getPoint()).line); }
Example 15
Source File: ScreenMarkerMouseListener.java From plugins with GNU General Public License v3.0 | 5 votes |
@Override public MouseEvent mouseClicked(MouseEvent event) { if (SwingUtilities.isMiddleMouseButton(event)) { return event; } event.consume(); return event; }
Example 16
Source File: NervousText.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public synchronized void mousePressed(MouseEvent e) { e.consume(); threadSuspended = !threadSuspended; if (!threadSuspended) { notify(); } }
Example 17
Source File: ChartGestureMouseAdapter.java From mzmine2 with GNU General Public License v2.0 | 5 votes |
@Override public void mouseClicked(MouseEvent e) { if (gestureHandlers == null || gestureHandlers.isEmpty() || !(listensFor(Event.CLICK) || listensFor(Event.DOUBLE_CLICK))) return; if (e.getComponent() instanceof ChartPanel) { ChartPanel chartPanel = (ChartPanel) e.getComponent(); ChartEntity entity = findChartEntity(chartPanel, e); ChartGesture.Entity gestureEntity = ChartGesture.getGestureEntity(entity); Button button = Button.getButton(e.getButton()); if (!e.isConsumed()) { // double clicked if (e.getClickCount() == 2) { // reset click count to handle double clicks quickly e.consume(); // handle event handleEvent(new ChartGestureEvent(chartPanel, e, entity, new ChartGesture(gestureEntity, Event.DOUBLE_CLICK, button))); } else if (e.getClickCount() == 1) { // handle event handleEvent(new ChartGestureEvent(chartPanel, e, entity, new ChartGesture(gestureEntity, Event.CLICK, button))); } } } }
Example 18
Source File: FilterKernelForm.java From snap-desktop with GNU General Public License v3.0 | 4 votes |
private void showPopup(MouseEvent e, FilterKernelCanvas kernelCanvas) { e.consume(); JPopupMenu popupMenu = createPopupMenu(kernelCanvas); popupMenu.show(kernelCanvas, e.getX(), e.getY()); }
Example 19
Source File: PopupListener.java From mzmine2 with GNU General Public License v2.0 | 4 votes |
public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger()) { popup.show(e.getComponent(), e.getX(), e.getY()); e.consume(); } }
Example 20
Source File: MultiSplitPane.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void mouseMoved( MouseEvent e ) { switchCursor( e ); e.consume(); }