@Override public MouseEvent mouseDragged(MouseEvent event) { if (!plugin.isCreatingScreenMarker()) { return event; } if (SwingUtilities.isLeftMouseButton(event)) { plugin.resizeMarker(event.getPoint()); } return event; } }
@Override public MouseEvent mouseDragged(MouseEvent mouseEvent) { if (!SwingUtilities.isLeftMouseButton(mouseEvent)) { return mouseEvent; } int nco = getCharOffset.applyAsInt(mouseEvent); if (selectionStart != -1) { selectionEnd = nco; cursorAt(selectionStart, selectionEnd); } return mouseEvent; }
@Override public MouseEvent mousePressed(MouseEvent event) { if (!overlay.isMapShown() || isNotWithinOverlay(event.getPoint())) { return event; } if (SwingUtilities.isLeftMouseButton(event) && isWithinCloseButton(event.getPoint())) { plugin.closeMap(); } event.consume(); return event; }
@Override public MouseEvent mouseReleased(MouseEvent event) { if (SwingUtilities.isMiddleMouseButton(event)) { return event; } if (SwingUtilities.isLeftMouseButton(event) && plugin.isCreatingScreenMarker()) { /* Set the creation panel as "ready" (because the marker area as been drawn) */ plugin.completeSelection(); } event.consume(); return event; }
@Override public void mousePressed(MouseEvent event) { boolean isClickCountMatches = (event.getClickCount() == 1 && luytenPrefs.isSingleClickOpenEnabled()) || (event.getClickCount() == 2 && !luytenPrefs.isSingleClickOpenEnabled()); if (!isClickCountMatches) return; if (!SwingUtilities.isLeftMouseButton(event)) return; final TreePath trp = tree.getPathForLocation(event.getX(), event.getY()); if (trp == null) return; Object lastPathComponent = trp.getLastPathComponent(); boolean isLeaf = (lastPathComponent instanceof TreeNode && ((TreeNode) lastPathComponent).isLeaf()); if (!isLeaf) return; new Thread() { public void run() { openEntryByTreePath(trp); } }.start(); } }
@Override public MouseEvent mousePressed(MouseEvent event) { if (SwingUtilities.isMiddleMouseButton(event)) { return event; } if (SwingUtilities.isLeftMouseButton(event)) { plugin.startCreation(event.getPoint()); } else if (plugin.isCreatingScreenMarker()) { plugin.finishCreation(true); } event.consume(); return event; }
if (SwingUtilities.isLeftMouseButton(e))
@Override public MouseEvent mousePressed(MouseEvent e) { final List<WorldMapPoint> worldMapPoints = worldMapPointManager.getWorldMapPoints(); if (SwingUtilities.isLeftMouseButton(e) && !worldMapPoints.isEmpty()) { Point mousePos = client.getMouseCanvasPosition(); for (WorldMapPoint worldMapPoint : worldMapPoints) { Rectangle clickbox = worldMapPoint.getClickbox(); if (clickbox != null && clickbox.contains(mousePos.getX(), mousePos.getY())) { if (worldMapPoint.isJumpOnClick()) { // jump map to position of point WorldPoint target = worldMapPoint.getWorldPoint(); RenderOverview renderOverview = client.getRenderOverview(); renderOverview.setWorldMapPositionTarget(target); } return worldMapPoint.onClick(e); } } } return e; }
@Override public void mousePressed(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e)) { this.lastDragPoint = e.getPoint(); } }
/** Determines if the event is originated from a left mouse button * @param e the MouseEvent * @return true if the event is originated from the left mouse button, false otherwise * @deprecated Offers no advantages over the standard {@link SwingUtilities#isLeftMouseButton}. */ @Deprecated public static boolean isLeftMouseButton(MouseEvent e) { return javax.swing.SwingUtilities.isLeftMouseButton(e); }
@Override public void mousePressed(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e)) { isDragging = true; beginSelectionDrag(e.getX(), e.getY(), e.isShiftDown()); updateSelectionDrag(e.getX(), e.getY()); } }
protected void maybeShowPopup(MouseEvent evt, Component comp) { if (evt != null && !SwingUtilities.isLeftMouseButton(evt)) { return; } JPopupMenu pm = popupMenu.getPopupMenu(); pm.show(comp, 0, comp.getHeight() - 1); searchTextField.setText(""); searchTextField.requestOriginalFocusOwner(); }
@Override public void mouseDragged(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e)) { Point point = e.getPoint(); if (this.lastDragPoint != null) { this.mapView.onMoveEvent(); int moveHorizontal = point.x - this.lastDragPoint.x; int moveVertical = point.y - this.lastDragPoint.y; this.mapView.getModel().mapViewPosition.moveCenter(moveHorizontal, moveVertical); } this.lastDragPoint = point; } }
@Override public void mouseClicked(MouseEvent e) { super.mouseClicked(e); AbstractRadioLink radio = (AbstractRadioLink) e.getComponent(); if (radio.isActivable() && SwingUtilities.isLeftMouseButton(e)) { for (JLabel label: radio.getGroup()) { if ((JLabel) e.getComponent() != label) { label.setFont(HelperUi.FONT_SEGOE); } else { radio.action(); } } radio.setUnderlined(); this.original = e.getComponent().getFont(); radio.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
@Override public void mouseClicked(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) { // Select if not selected if (!card.isSelected()) { selectCard(card); } // Show menu showCardRightClickMenu(card, e); } else if (SwingUtilities.isLeftMouseButton(e)) { if (e.getClickCount() == 1) { cardClicked(card, e); } else if (e.isAltDown()) { eventSource.fireEvent(card, ClientEventType.ALT_DOUBLE_CLICK); } else { eventSource.fireEvent(card, ClientEventType.DOUBLE_CLICK); } } } });
@Override public void mouseClicked(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e)) { LatLong tapLatLong = this.mapView.getMapViewProjection().fromPixels(e.getX(), e.getY()); if (tapLatLong != null) { org.mapsforge.core.model.Point tapXY = new org.mapsforge.core.model.Point(e.getX(), e.getY()); for (int i = this.mapView.getLayerManager().getLayers().size() - 1; i >= 0; --i) { Layer layer = this.mapView.getLayerManager().getLayers().get(i); org.mapsforge.core.model.Point layerXY = this.mapView.getMapViewProjection().toPixels(layer.getPosition()); if (layer.onTap(tapLatLong, layerXY, tapXY)) { break; } } } } }
@Override public void mouseDragged(MouseEvent e, TransferData transferData) { CardPanel cardPanel = ((CardPanel) transferData.component); if (cardPanel.getZone() == null || !cardPanel.getZone().equalsIgnoreCase("hand")) { // drag'n'drop is allowed for HAND zone only return; } if (!SwingUtilities.isLeftMouseButton(e)) { // only allow draging with the left mouse button return; } isDragging = true; prevCardPanel = cardPanel; Point cardPanelLocationOld = cardPanel.getLocation(); Point mouse = new Point(e.getX(), e.getY()); SwingUtilities.convertPointToScreen(mouse, transferData.component); int xOffset = cardPanel.getXOffset(cardPanel.getCardWidth()); int newX = Math.max(initialCardPos.x + (int) (mouse.getX() - initialMousePos.x) - xOffset, 0); cardPanel.setCardBounds( newX, cardPanelLocationOld.y + cardPanel.getCardYOffset(), cardPanel.getCardWidth(), cardPanel.getCardHeight()); cardPanel.getCardArea().setComponentZOrder(cardPanel, 0); sort(cardPanel, cardPanel.getCardArea(), false); if (!this.startedDragging) { this.startedDragging = true; } }
@Override public void mousePressed(MouseEvent e) { dragStarted = 0; /** * Only allow a drag to start using the left mouse button. Can't * use isPopupTrigger() to prevent it from dragging when opening * a context menu, because the popup trigger isn't necessarily * available in mousePressed(). */ canDrag = SwingUtilities.isLeftMouseButton(e); }
int nclicks = e.getClickCount(); if (SwingUtilities.isLeftMouseButton(e)) { if (nclicks>2) { nclicks %= 2; // Alternate selecting word/line.
@Override public void mousePressed(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e)) { button.setBackground(AppThemeColor.SLIDE_BG); button.setText("Press any key"); allowed = true; button.removeMouseListener(this); } } };