public void mouseReleased(MouseEvent e) { lastInteractionTime = System.currentTimeMillis(); if (enabled && !readOnly && lastPressEvent != null && dragInProgress) { if (enableMouseDrags && !e.getPoint().equals(lastPressEvent.getPoint())) { dragInProgress = false; // Generate the command string String s = "Mouse " + MouseCommand.MOUSE_DRAG; // Insert the button identifier if other than left button was pressed if (e.getButton() != MouseEvent.BUTTON1) { s += " " + MouseCommand.PARAM_BUTTON_SHORT + "=" + parser.buttonToString(e.getButton()); } // Insert modifiers if there are any String modifiers = parser.modifiersToString(e.getModifiers()); if (modifiers.length() > 0) { s += " " + MouseCommand.PARAM_MODIFIER + "=" + modifiers; } // Generate coordinates s += " " + MouseCommand.PARAM_FROM + "=" + parser.pointToString(lastPressEvent.getPoint()); s += " " + MouseCommand.PARAM_TO + "=" + parser.pointToString(e.getPoint()); // Insert the command to the current editor insertLine(s, false, true, false); insertEvent(e); } } }
// Handle mouse actions public void mousePressed(MouseEvent mouseEvent) { if (this.isArmed() && this.isUseRubberBand() && mouseEvent.getButton() == MouseEvent.BUTTON1) { if ((mouseEvent.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) != 0) { if (!mouseEvent.isControlDown()) { this.setActive(true); measureTool.addControlPoint(); if (measureTool.getControlPoints().size() == 1) { measureTool.addControlPoint(); // Simulate a second click } // Set the rubber band target to the last control point or the relevant control for // regular shapes. if (measureTool.isRegularShape()) { String initControl = measureTool.getShapeInitialControl(measureTool.getWwd().getCurrentPosition()); rubberBandTarget = measureTool.getControlPoint(initControl); } else { rubberBandTarget = (MeasureTool.ControlPoint) measureTool.getControlPoints().get(measureTool.getControlPoints().size() - 1); } measureTool.firePropertyChange(MeasureTool.EVENT_RUBBERBAND_START, null, null); } } mouseEvent.consume(); } else if (!this.isArmed() && mouseEvent.getButton() == MouseEvent.BUTTON1 && mouseEvent.isAltDown()) { if (!this.measureTool.isRegularShape()) { this.setMoving(true); this.movingTarget = this.lastPickedObject; } mouseEvent.consume(); } }
/** * Open the popup menu. * * @param evt */ private void sampleCvTermsJTableMouseClicked( java.awt.event.MouseEvent evt) { // GEN-FIRST:event_sampleCvTermsJTableMouseClicked if (evt.getButton() == 3) { int row = sampleCvTermsJTable.rowAtPoint(evt.getPoint()); int column = sampleCvTermsJTable.columnAtPoint(evt.getPoint()); sampleCvTermsJTable.changeSelection(row, column, false, false); this.moveUpJMenuItem.setEnabled(true); this.moveDownJMenuItem.setEnabled(true); if (row == sampleCvTermsJTable.getRowCount() - 1) { this.moveDownJMenuItem.setEnabled(false); } if (row == 0) { this.moveUpJMenuItem.setEnabled(false); } popupJMenu.show(evt.getComponent(), evt.getX(), evt.getY()); } else if (evt.getButton() == 1 && evt.getClickCount() == 2) { editJMenuItemActionPerformed(null); } } // GEN-LAST:event_sampleCvTermsJTableMouseClicked
/** * {@inheritDoc} * * @see swing.gui.AbstractMainPanel#boardClick(java.awt.event.MouseEvent) */ @Override protected void boardClick(final MouseEvent mouseEvent) { final int idX = ((FieldComponent) mouseEvent.getComponent()).getIdX(); final int idY = ((FieldComponent) mouseEvent.getComponent()).getIdY(); if (mouseEvent.getButton() == MouseEvent.BUTTON1 && mouseEvent.isShiftDown()) { // Linke Maustaste + SHIFT = Wert aendern if (getFieldComponent(idX, idY).getValue() < getFieldComponent(idX, idY).getMaxValue()) { getFieldComponent(idX, idY).setValue(getFieldComponent(idX, idY).getValue() + 1); } else { getFieldComponent(idX, idY).setValue(0); } } else if (mouseEvent.getButton() == MouseEvent.BUTTON1 && mouseEvent.isControlDown()) { // Linke Maustaste + STRG = Besitzer aendern if (getFieldComponent(idX, idY).getOwnerId() < GameSession.gameOptions.getMaxPlayers() - 1) { getFieldComponent(idX, idY).setOwner(getFieldComponent(idX, idY).getOwnerId() + 1); } else { getFieldComponent(idX, idY).setOwner(-1); } } else if (mouseEvent.getButton() == MouseEvent.BUTTON1 && mouseEvent.isAltDown()) { // Linke Maustaste + ALT = Reset getFieldComponent(idX, idY).setValue(0); getFieldComponent(idX, idY).setOwner(-1); getFieldComponent(idX, idY).setEnabled(true); } else if (mouseEvent.getButton() == MouseEvent.BUTTON1) { // Linke Maustaste = Aktivieren/Deaktivieren if (getFieldComponent(idX, idY).isEnabled()) { getFieldComponent(idX, idY).setEnabled(false); } else { getFieldComponent(idX, idY).setEnabled(true); } } repaint(); }
public void fireMouseEventForHeader(MouseEvent E, int type) { int column = columnAtPoint(E.getPoint()); // System.out.println("type="+type+", column="+column+", prevcol="+prevcol); if (type == zc3MouseAdaptForHeader.ENTER) { informHEntered(column); prevcol = column; } else if (type == zc3MouseAdaptForHeader.LEAVE) { informHLeft(prevcol); prevcol = -1; } else if (type == zc3MouseAdaptForHeader.MOVE && prevcol != column) { informHLeft(prevcol); informHEntered(column); prevcol = column; } else if (type == zc3MouseAdaptForHeader.CLICKED) { informHClicked(column); } else if (type == zc3MouseAdaptForHeader.DOUBLECLICK) { fireDoubleClickForHeader(E); } else if (type == zc3MouseAdaptForHeader.PRESSED) { if (E.getButton() == MouseEvent.BUTTON1) { informHPressed(column); } } else if (type == zc3MouseAdaptForHeader.RELEASED) { if (E.getButton() == MouseEvent.BUTTON1) { informHReleased(column); } } }
public void mousePressed(MouseEvent e) { mousePressX = e.getX(); mousePressY = e.getY(); graphPanel .getScaleMode() .init( graphs, (graphPanel.getOverlayState() == true) || (graphPanel.getSelectState() == true) ? graphPanel.getCurrentChannelShowSet() : graphPanel.getChannelShowSet(), graphPanel.getTimeRange(), graphPanel.getMeanState(), getHeight()); // one-button mouse Mac OSX behaviour emulation if (e.getButton() == MouseEvent.BUTTON1) { if (e.isShiftDown()) { button = MouseEvent.BUTTON2; } else if (e.isControlDown()) { button = MouseEvent.BUTTON3; } else { button = MouseEvent.BUTTON1; } } else { button = e.getButton(); } graphPanel.dispatchEvent(SwingUtilities.convertMouseEvent(this, e, graphPanel)); }
public void mouseReleased(MouseEvent e) { Point mousePosition = new Point(MouseInfo.getPointerInfo().getLocation()); SwingUtilities.convertPointFromScreen(mousePosition, this); // Mouse 1 if (e.getButton() == MouseEvent.BUTTON1) { L_MOUSE_DOWN = false; for (int i = 0; i < rootCrowd.getMouseActionList().size(); i++) { // if the mouse click is in the hitbox then peform the action if (rootCrowd.getMouseActionList().get(i).isActive() && rootCrowd.getMouseActionList().get(i).isInBounds(mousePosition.x, mousePosition.y)) { if (rootCrowd.getMouseActionList().get(i).mU(mousePosition, e)) return; } } } // Mouse 2, BUTTON2 is middle mouse else if (e.getButton() == MouseEvent.BUTTON3) { for (int i = 0; i < rootCrowd.getMouseActionList().size(); i++) { // if the mouse click is in the hitbox then peform the action if (rootCrowd.getMouseActionList().get(i).isActive() && rootCrowd.getMouseActionList().get(i).isInBounds(mousePosition.x, mousePosition.y)) { if (rootCrowd.getMouseActionList().get(i).rMU(mousePosition, e)) return; } } } }
/* (non-Javadoc) * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent) */ @Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1 && displayMode == DISPLAY_UNITS) drawPossibleMovement(x, y); if (e.getButton() == MouseEvent.BUTTON3 && displayMode == DISPLAY_UNITS) clearPossibleMovement(); }
void dispatch() { synchronized (events) { if (mousemv != null) { mousepos = new Coord(mousemv.getX(), mousemv.getY()); ui.mousemove(mousemv, mousepos); mousemv = null; } InputEvent e = null; while ((e = events.poll()) != null) { if (e instanceof MouseEvent) { MouseEvent me = (MouseEvent) e; if (me.getID() == MouseEvent.MOUSE_PRESSED) { ui.mousedown(me, new Coord(me.getX(), me.getY()), me.getButton()); } else if (me.getID() == MouseEvent.MOUSE_RELEASED) { ui.mouseup(me, new Coord(me.getX(), me.getY()), me.getButton()); } else if (me instanceof MouseWheelEvent) { ui.mousewheel( me, new Coord(me.getX(), me.getY()), ((MouseWheelEvent) me).getWheelRotation()); } } else if (e instanceof KeyEvent) { KeyEvent ke = (KeyEvent) e; if (ke.getID() == KeyEvent.KEY_PRESSED) { ui.keydown(ke); } else if (ke.getID() == KeyEvent.KEY_RELEASED) { ui.keyup(ke); } else if (ke.getID() == KeyEvent.KEY_TYPED) { ui.type(ke); } } ui.lastevent = System.currentTimeMillis(); } } }
private void mousePressedInIconsArea(MouseEvent e) { EditorMessageIconRenderer iconRenderer = getIconRendererUnderMouse(e); if (iconRenderer != null) { if (e.getButton() == MouseEvent.BUTTON3) { JPopupMenu popupMenu = iconRenderer.getPopupMenu(); if (popupMenu != null && e.getID() == MouseEvent.MOUSE_PRESSED) { e.consume(); Component component = e.getComponent(); popupMenu.show(component == null ? myEditorComponent : component, e.getX(), e.getY()); } return; } AnAction action = iconRenderer.getClickAction(); if (e.getButton() == MouseEvent.BUTTON1 && action != null) { if (e.getID() == MouseEvent.MOUSE_CLICKED) { AnActionEvent actionEvent = new AnActionEvent( e, new LeftEditorHighlighterDataContext(myEditorComponent, iconRenderer.getNode()), ICON_AREA, action.getTemplatePresentation(), ActionManager.getInstance(), e.getModifiers()); action.update(actionEvent); action.actionPerformed(actionEvent); } e.consume(); } } }
/** * Initialize the dragging, either with button 1 (simple dragging) or button 3 (selection of a * picture part) */ public void mousePressed(MouseEvent e) { if (image == null) { mouseIsDragging = false; selectedRect = null; return; } Image image; Rectangle visibleRect; synchronized (ImageDisplay.this) { image = ImageDisplay.this.image; visibleRect = ImageDisplay.this.visibleRect; } if (image == null) return; if (e.getButton() == DRAG_BUTTON) { mousePointInImg = comp2imgCoord(visibleRect, e.getX(), e.getY()); mouseIsDragging = true; selectedRect = null; } else if (e.getButton() == ZOOM_BUTTON) { mousePointInImg = comp2imgCoord(visibleRect, e.getX(), e.getY()); checkPointInVisibleRect(mousePointInImg, visibleRect); mouseIsDragging = false; selectedRect = new Rectangle(mousePointInImg.x, mousePointInImg.y, 0, 0); ImageDisplay.this.repaint(); } else { mouseIsDragging = false; selectedRect = null; } }
public void mouseReleased(MouseEvent e) { logEvent("MouseReleased", e); // send event to the pressedNode publishMouseEvent( e.getX(), e.getY(), EventBus.getSystem().getPressedNode(), org.joshy.gfx.event.MouseEvent.MouseReleased, e.getButton(), e.isShiftDown(), e.isAltDown(), e.isControlDown(), e.isMetaDown()); // also send event to the top node under the cursor if it's not the pressedNode Node node = findTopNode(e.getX(), e.getY()); if (node != EventBus.getSystem().getPressedNode()) { publishMouseEvent( e.getX(), e.getY(), node, org.joshy.gfx.event.MouseEvent.MouseReleased, e.getButton(), e.isShiftDown(), e.isAltDown(), e.isControlDown(), e.isMetaDown()); } EventBus.getSystem().setPressedNode(null); }
public void eventDispatched(AWTEvent event) { if (isDirectedScanning) { MouseEvent me = (MouseEvent) event; if (me.getButton() == MouseEvent.BUTTON1) { // 96 // if (HiHaFiambreig) PararTimerFiambreig(); if (me.getID() == MouseEvent.MOUSE_RELEASED) { if (withSwaying) { stopSwayingTimer(); } actPanel.clickLeftButton(); if (withSwaying) { startDirectedScanSwayingTimer(); } } } else if (me.getButton() == MouseEvent.BUTTON3) { if (event.getID() == MouseEvent.MOUSE_RELEASED) { if (withSwaying) { stopSwayingTimer(); } actPanel.nextScanPosition(); if (withSwaying) { startSwayingTimer(); } } } } }
// If the user double clicks on a stock with the LMB, graph the stock. // If the user right clicks over the table, open up a popup menu. private void handleMouseClicked(MouseEvent event) { Point point = event.getPoint(); // Right click on the table - raise menu if (event.getButton() == MouseEvent.BUTTON3) { JPopupMenu menu = new JPopupMenu(); popupGraphSymbols = MenuHelper.addMenuItem(this, menu, Locale.getString("GRAPH")); popupGraphSymbols.setEnabled(getSelectedRowCount() > 0); popupTableSymbols = MenuHelper.addMenuItem(this, menu, Locale.getString("TABLE")); popupTableSymbols.setEnabled(getSelectedRowCount() > 0); menu.show(this, point.x, point.y); } // Left double click on the table - graph stock else if (event.getButton() == MouseEvent.BUTTON1 && event.getClickCount() == 2) { int[] selectedRows = getSelectedRows(); List symbols = new ArrayList(); for (int i = 0; i < selectedRows.length; i++) { Symbol symbol = (Symbol) model.getValueAt(selectedRows[i], EODQuoteModel.SYMBOL_COLUMN); symbols.add(symbol); } // Graph the highlighted symbols CommandManager.getInstance().graphStockBySymbol(symbols); } }
/* mouse events */ public void mousePressed(MouseEvent e) { int x = e.getX(); int y = e.getY(); /* left click */ if (e.getButton() == MouseEvent.BUTTON1) { if (x >= posX && x < posX + Constant.BATTLEFIELD_WIDTH) { if (y >= posY) { if (y < posY + Constant.BATTLEFIELD_HEIGHT) { battle_field.doPress((x - posX), (y - posY)); return; } else if (y < posY + Constant.BATTLEFIELD_HEIGHT + Constant.CARDPANEL_HEIGHT) { card_panel.doDrag(x - posX, y - (posY + Constant.BATTLEFIELD_HEIGHT)); return; } } } /* right click */ } else if (e.getButton() == MouseEvent.BUTTON3) { if (x >= posX && x < posX + Constant.BATTLEFIELD_WIDTH) { if (y >= posY) { if (y < posY + Constant.BATTLEFIELD_HEIGHT) { Skill skill = arena.player.useSkill(skill_id, x - posX, y - posY); if (skill != null) { arena.addSkill(skill); } return; } else if (y < posY + Constant.BATTLEFIELD_HEIGHT + Constant.CARDPANEL_HEIGHT) { card_panel.changeDetail(x - posX, y - (posY + Constant.BATTLEFIELD_HEIGHT)); return; } } } } }
@Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { Data.addPolygonVertex(new Point2D(e.getX(), e.getY())); } else if (e.getButton() == MouseEvent.BUTTON3) { Data.setMainPoint(new Point2D(e.getX(), e.getY())); } }
@Override public void mouseClicked(MouseEvent e) { if (e.getButton() == LEFT_CLICK) { deleteSprite(e.getX(), e.getY()); } else if (e.getButton() == RIGHT_CLICK) { createSprite(e.getX(), e.getY()); } }
private void mainPanelMouseClicked( java.awt.event.MouseEvent evt) { // GEN-FIRST:event_mainPanelMouseClicked if (evt.getButton() == MouseEvent.BUTTON1) { mc.addPoint(evt.getX(), evt.getY(), evt.isShiftDown()); } else if (evt.getButton() == MouseEvent.BUTTON3) { mc.undo(); } mainPanel.repaint(); } // GEN-LAST:event_mainPanelMouseClicked
private void doViewOnMousePressed(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { increaseViewScale(); } else if (e.getButton() == MouseEvent.BUTTON3) { decreaseViewScale(); } internalFrame.open(); repaint(); }
/** * ********************************************************************************* REQUIRED * METHODS FOR INTERFACES * ******************************************************************************** */ public void mouseClicked(MouseEvent e) { if (e.isConsumed()) { return; } TreePath path = ((JTree) e.getSource()).getClosestPathForLocation(e.getX(), e.getY()); ((TreeView) WorkspaceController.getCurrentModeExtension().getView()).addSelectionPath(path); if (path != null) { AWorkspaceTreeNode node = (AWorkspaceTreeNode) path.getLastPathComponent(); // encode buttons int eventType = 0; if (e.getButton() == MouseEvent.BUTTON1) { eventType += WorkspaceActionEvent.MOUSE_LEFT; } if (e.getButton() == MouseEvent.BUTTON3) { eventType += WorkspaceActionEvent.MOUSE_RIGHT; } if (e.getClickCount() % 2 == 0) { eventType += WorkspaceActionEvent.MOUSE_DBLCLICK; } else { eventType += WorkspaceActionEvent.MOUSE_CLICK; } if (e.isPopupTrigger()) { eventType += WorkspaceActionEvent.POPUP_TRIGGER; } WorkspaceActionEvent event = new WorkspaceActionEvent(node, eventType, e.getX(), e.getY(), e.getComponent()); List<IWorkspaceNodeActionListener> nodeEventListeners = WorkspaceController.getCurrentModeExtension() .getIOController() .getNodeActionListeners(node.getClass(), eventType); if (nodeEventListeners != null) { for (IWorkspaceNodeActionListener listener : nodeEventListeners) { if (event.isConsumed()) { break; } listener.handleAction(event); } } if (!event.isConsumed() && node instanceof IWorkspaceNodeActionListener) { ((IWorkspaceNodeActionListener) node).handleAction(event); } } else { if (e.getButton() == MouseEvent.BUTTON3) { // WorkspaceController.getController().getPopups().showWorkspacePopup(e.getComponent(), // e.getX(), e.getY()); ((AWorkspaceTreeNode) WorkspaceController.getCurrentModel().getRoot()) .showPopup(e.getComponent(), e.getX(), e.getY()); } } }
@Override public void mouseReleased(MouseEvent e) { isLeftButtonPressed = false; if (e.getButton() == MouseEvent.BUTTON3) { ((DrawPad) parent).getSelectedLayer().undoLastDraw(); } else if ((e.getButton() == MouseEvent.BUTTON1) && ((DrawPad) parent).isRubberMode()) { ((DrawPad) parent).getSelectedLayer().eraseEnd(); } parent.repaint(); }
/** * To be used when debugging the mouse events. Use it in one of the mouse event methods and pass * in the mouse event that is generated and it will be able to tell you which button had its * 'state' changed. * * @param e - Mouse event from one of the mouse event methods. * @return Returns the name of the button whose state was changed. */ private String translateButton(MouseEvent e) { if (e.getButton() == 0) { return "No Button"; } else if (e.getButton() == 1) { return "Left Button"; } else if (e.getButton() == 2) { return "Middle Button"; } else { return "Right Button"; } }
@Override public void mousePressed(MouseEvent e) { if (Game.currentGame.placedStruct || Game.currentGame.activeStruct != null) return; e.translatePoint(-x, -y); if (e.getButton() == MouseEvent.BUTTON1) // LMB { if (selectedEntity != null && selectedEntity instanceof Struct && ((Struct) selectedEntity).guiPoint != null && ((Struct) selectedEntity).components.size() > 0) return; selectedEntity = null; for (Entity entity : entities) entity.setClicked(false); for (Entity entity : entities) { if (entity.mousePressed(e)) { selectedEntity = entity; break; } } } else if (e.getButton() == MouseEvent.BUTTON3 && selectedEntity != null && selectedEntity instanceof Villager) { Entity target = null; for (Entity entity : entities) { if (entity.mousePressed(e)) { target = entity; break; } } setVillagerTarget((Villager) selectedEntity, e.getX(), e.getY(), target); } else if (e.getButton() == MouseEvent.BUTTON3) // after Drag { Entity target = null; for (Entity entity : entities) { if (entity.isClicked() && entity instanceof Villager) continue; if (entity.mousePressed(e)) { target = entity; break; } } for (Entity entity : entities) { if (entity.isClicked() && entity instanceof Villager) { setVillagerTarget((Villager) entity, e.getX(), e.getY(), target); } } } e.translatePoint(x, y); }
public void mouseMoved(MouseEvent e) { logEvent("MouseMoved", e); Node node = findTopNode(e.getX(), e.getY()); if (node != hoverNode) { if (hoverNode != null) { Point2D point = convertSceneToNode(e.getX(), e.getY(), hoverNode); org.joshy.gfx.event.MouseEvent evt = new org.joshy.gfx.event.MouseEvent( org.joshy.gfx.event.MouseEvent.MouseExited, point.getX(), point.getY(), hoverNode, e.getButton(), e.isShiftDown(), e.isAltDown(), e.isControlDown(), e.isMetaDown()); EventBus.getSystem().publish(evt); } hoverNode = node; if (hoverNode != null) { Point2D point = convertSceneToNode(e.getX(), e.getY(), hoverNode); org.joshy.gfx.event.MouseEvent evt = new org.joshy.gfx.event.MouseEvent( org.joshy.gfx.event.MouseEvent.MouseEntered, point.getX(), point.getY(), hoverNode, e.getButton(), e.isShiftDown(), e.isAltDown(), e.isControlDown(), e.isMetaDown()); EventBus.getSystem().publish(evt); } } Point2D point = convertSceneToNode(e.getX(), e.getY(), node); org.joshy.gfx.event.MouseEvent evt = new org.joshy.gfx.event.MouseEvent( org.joshy.gfx.event.MouseEvent.MouseMoved, point.getX(), point.getY(), node, e.getButton(), e.isShiftDown(), e.isAltDown(), e.isControlDown(), e.isMetaDown()); EventBus.getSystem().publish(evt); }
/** * Provides default behavior for mouse clicks. * * <p>If graphics classes have been registered using {@linkplain #registerMouseClickClasses()} for * left-clicks and {@linkplain #registerMapMenuClasses()} for right-clicks, it is checked whether * one of these classes have been clicked. * * @param evt the mouse event */ @Override public boolean mouseClicked(MouseEvent evt) { if (evt.getButton() == MouseEvent.BUTTON1 && !mouseClickClasses.isEmpty()) { OMGraphic clickedGraphics = getSelectedGraphic( mouseClickGraphics, evt, mouseClickClasses.toArray(new Class<?>[mouseClickClasses.size()])); if (clickedGraphics != null) { // Clean up any info panels hideInfoPanels(); if (HIDE_GLASS_PANEL) { getGlassPanel().setVisible(false); } // Allow custom handling of right-clicks by sub-classes handleMouseClick(clickedGraphics, evt); return true; } else { handleMouseClick(null, evt); } } else if (evt.getButton() == MouseEvent.BUTTON3 && !mapMenuClasses.isEmpty()) { OMGraphic clickedGraphics = getSelectedGraphic( mapMenuGraphics, evt, mapMenuClasses.toArray(new Class<?>[mapMenuClasses.size()])); if (clickedGraphics != null) { // Clean up any info panels hideInfoPanels(); if (HIDE_GLASS_PANEL) { getGlassPanel().setVisible(false); } // Allow custom map menu initialization by sub-classes initMapMenu(clickedGraphics, evt); // Display the menu int yOffset = 2; if (mainFrame.getHeight() < evt.getYOnScreen() + mapMenu.getHeight()) { yOffset = mapMenu.getHeight(); } mapMenu.show(this, evt.getX() - 2, evt.getY() - yOffset); return true; } } return false; }
/** If the correct button, from the "drawing rectangle" mode */ @Override public void mousePressed(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() > 1) { SelectByInternalPointAction.performSelection( Main.map.mapView.getEastNorth(e.getX(), e.getY()), (e.getModifiersEx() & MouseEvent.SHIFT_DOWN_MASK) > 0, (e.getModifiersEx() & MouseEvent.CTRL_DOWN_MASK) > 0); } else if (e.getButton() == MouseEvent.BUTTON1) { mousePosStart = mousePos = e.getPoint(); lasso.reset(); lasso.addPoint(mousePosStart.x, mousePosStart.y); } }
@Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) { controller.goToSegmentAtLocation(getCaretPosition()); } if (e.isPopupTrigger() || e.getButton() == MouseEvent.BUTTON3) { PopupMenuConstructorInfo[] cons; synchronized (popupConstructors) { /** Copy constructors - for disable blocking in the procesing time. */ cons = popupConstructors.toArray(new PopupMenuConstructorInfo[popupConstructors.size()]); } // where is the mouse int mousepos = viewToModel(e.getPoint()); boolean isInActiveTranslation = mousepos >= getOmDocument().getTranslationStart() && mousepos <= getOmDocument().getTranslationEnd(); boolean isInActiveEntry; int ae = controller.displayedEntryIndex; SegmentBuilder sb = controller.m_docSegList[ae]; if (sb.isActive()) { isInActiveEntry = mousepos >= sb.getStartPosition() && mousepos <= sb.getEndPosition(); } else { isInActiveEntry = false; } JPopupMenu popup = new JPopupMenu(); for (PopupMenuConstructorInfo c : cons) { // call each constructor c.constructor.addItems( popup, EditorTextArea3.this, mousepos, isInActiveEntry, isInActiveTranslation, sb); } DockingUI.removeUnusedMenuSeparators(popup); if (popup.getComponentCount() > 0) { popup.show( EditorTextArea3.this, (int) e.getPoint().getX(), (int) e.getPoint().getY()); } } }
@Override public void mousePressed(MouseEvent e) { // TODO Auto-generated method stub long time = System.nanoTime(); int button = e.getButton(); if (time - lastTimeClicked < 200000000 && button == lastButton) { Panel.menu = !Panel.menu; return; } lastButton = button; lastTimeClicked = time; if (e.getButton() == MouseEvent.BUTTON3 && calc.getZoom() <= 1) { calc.setZoom(1); return; } double r = calc.PixToWorld(e.getX(), calc.W / 2, calc.dX); double i = calc.PixToWorld(e.getY(), calc.H / 2, calc.dY); if (e.getButton() == MouseEvent.BUTTON1) calc.setZoom(calc.getZoom() * 2); else if (e.getButton() == MouseEvent.BUTTON3) calc.setZoom(calc.getZoom() / 2); else if (e.getButton() == MouseEvent.BUTTON2) { try { String a = String.valueOf(calc.dX); String b = String.valueOf(calc.dY); String c = String.valueOf(calc.getZoom()); ImageIO.write(Panel.getImage(), "png", new File(a + "-" + b + "-" + c + ".png")); } catch (IOException ex) { } return; } calc.dX = r; calc.dY = i; if (calc.getZoom() == 1) calc.dX = calc.dY = 0; calc.needUpdate = true; synchronized (panel.calcThread) { if (!calc.isSleeping) { calc.forceRestart = true; } else panel.calcThread.notify(); } }
public void mousePressed(MouseEvent e) { if (e.getButton() != MouseEvent.BUTTON1) { return; } if (e.getClickCount() != 2) { return; } JTable table = (JTable) e.getSource(); Point p = e.getPoint(); int row = table.rowAtPoint(p); if (row < 0) { return; } PickerTableModel model = getDataModel(); ICFInternetISOCountryObj o = (ICFInternetISOCountryObj) model.getValueAt(row, COLID_ROW_HEADER); invokeWhenChosen.choseISOCountry(o); try { Container cont = getParent(); while ((cont != null) && (!(cont instanceof JInternalFrame))) { cont = cont.getParent(); } if (cont != null) { ((JInternalFrame) cont).setClosed(true); } } catch (Exception x) { } }
public void mousePressed(MouseEvent e) { if (e.getButton() != MouseEvent.BUTTON1) { return; } if (e.getClickCount() != 2) { return; } JTable table = (JTable) e.getSource(); Point p = e.getPoint(); int row = table.rowAtPoint(p); if (row < 0) { return; } FinderTableModel model = getDataModel(); ICFSecurityISOTimezoneObj o = (ICFSecurityISOTimezoneObj) model.getValueAt(row, COLID_ROW_HEADER); if (o == null) { return; } JInternalFrame frame = swingSchema.getISOTimezoneFactory().newViewEditJInternalFrame(o); ((ICFSecuritySwingISOTimezoneJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View); if (frame == null) { return; } Container cont = getParent(); while ((cont != null) && (!(cont instanceof JInternalFrame))) { cont = cont.getParent(); } if (cont != null) { JInternalFrame myInternalFrame = (JInternalFrame) cont; myInternalFrame.getDesktopPane().add(frame); frame.setVisible(true); frame.show(); } }