List of usage examples for java.awt.event MouseEvent BUTTON2
int BUTTON2
To view the source code for java.awt.event MouseEvent BUTTON2.
Click Source Link
From source file:corelyzer.ui.CorelyzerGLCanvas.java
public void mousePressed(final MouseEvent e) { prePos = e.getPoint();// w w w.jav a2 s . c om float sp[] = { 0.0f, 0.0f }; this.convertMousePointToSceneSpace(prePos, scenePos); PAN_MODE = 0; ZOOM_MODE = 0; MANIPULATE_MODE = 0; // For mouse right-click or Ctrl-Left-Click if (e.isPopupTrigger()) { this.handleRightMouseClick(e); return; } switch (e.getButton()) { case MouseEvent.BUTTON1: if (canvasMode == CorelyzerApp.APP_MEASURE_MODE) { return; } else if (canvasMode == CorelyzerApp.APP_MARKER_MODE) { // the first check up: focused marker manipulation if (SceneGraph.focusedMarker > -1) { if (SceneGraph.hitMarker(canvasId, scenePos[0], scenePos[1])) { MANIPULATE_MODE = 1; /* * System.out.println( * "---- Left button pressed down at: " + prePos.x + * ", " + prePos.y); System.out.println( * "Converted to Scene Space: " + scenePos[0] + ", " * + sp[1]); * System.out.println("Marker manipulator hit!"); */ prescenePos[0] = scenePos[0]; prescenePos[1] = scenePos[1]; return; } } } else if (canvasMode == CorelyzerApp.APP_CLAST_MODE || canvasMode == CorelyzerApp.APP_CUT_MODE) { determineSelectedSceneComponents(scenePos, e); if (selectedTrackSection != -1) { if (!SceneGraph.getDepthOrientation()) { float t = scenePos[0]; scenePos[0] = scenePos[1]; scenePos[1] = -t; } SceneGraph.addClastPoint1(scenePos[0], scenePos[1]); this.convertScenePointToAbsolute(scenePos, sp); CorelyzerApp.getApp().getToolFrame().setClastUpperLeft(sp); } PAN_MODE = 0; return; } PAN_MODE = 1; // System.out.println("---- Left button pressed down at: " + // prePos.x + ", " + prePos.y); // System.out.println("Converted to Scene Space: " + // scenePos[0] + ", " + sp[1]); determineSelectedSceneComponents(scenePos, e); break; case MouseEvent.BUTTON2: // System.out.println("MOUSE BUTTON 2!!!???"); break; case MouseEvent.BUTTON3: // System.out.println("---- Right button clicked at: " + // prePos.x + ", " + prePos.y); // System.out.println("Converted to Scene Space: " + // scenePos[0] + ", " + sp[1]); this.handleRightMouseClick(e); break; default: // more reliable than BUTTON3 (ctrl-click) if (e.isPopupTrigger()) { this.handleRightMouseClick(e); } } }
From source file:gda.plots.SimplePlot.java
/** * Part of the implementation of MouseListener. Overrides the super class (ChartPanel) implementation so that the * mouse can be used to select a rectangle as well as for zooming. * /*from w w w . ja v a 2s . c o m*/ * @see #mousePressed(java.awt.event.MouseEvent) * @see #mouseDragged(java.awt.event.MouseEvent) * @param e * the mouse event which caused the call */ @Override public void mouseReleased(MouseEvent e) { // Unless a rectangle is being dragged we just // want to call the super class method (which // deals with zooming) if (rd == null) { super.mouseReleased(e); if (magnifyingImage || magnifyingData) { // If the button released is BUTTON1 then the rectangle for // magnification will have been resized. if (e.getButton() == MouseEvent.BUTTON1) { magnifyWidth = e.getX() - magnifyXPoint; magnifyHeight = e.getY() - magnifyYPoint; magnifyRectangleIsNew = true; } // If the button released is BUTTON2 then the rectangle will // have been being dragged around. Need to redraw in XOR mode // one // last time to remove rectangle from plot. else if (e.getButton() == MouseEvent.BUTTON2) { Graphics2D g2 = (Graphics2D) getGraphics(); g2.setXORMode(dragColour); if (magnifyRectangle != null) { g2.fill(magnifyRectangle); } g2.dispose(); } recalculateMagnifyRectangle(e); magnifier.update(magnifyRectangle); } } else { rd.mouseReleased(e); } }