List of usage examples for java.awt.event MouseEvent getY
public int getY()
From source file:org.fhcrc.cpl.viewer.quant.gui.LogRatioHistMouseListener.java
/** * Save the initial selection point/*www . jav a 2s .c o m*/ * @param e */ public void mousePressed(MouseEvent e) { Rectangle2D screenDataArea = _chartPanel.getScreenDataArea(e.getX(), e.getY()); if (screenDataArea != null) { this.selectedRegionStart = getPointInRectangle(e.getX(), e.getY(), screenDataArea); } else { this.selectedRegionStart = null; } }
From source file:analisisnumerico.Main.java
private void jPanel2MousePressed(java.awt.event.MouseEvent evt) { x = evt.getX(); y = evt.getY(); }
From source file:playground.sergioo.capacitiesChanger2012.gui.NetworkPanel.java
@Override public void mouseMoved(MouseEvent e) { double[] p = getWorld(e.getX(), e.getY()); window.setCoords(p[0], p[1]); }
From source file:Main.java
public GrabAndScrollLabel(ImageIcon i) { super(i);/*from www. j a va 2 s . com*/ MouseInputAdapter mia = new MouseInputAdapter() { int xDiff, yDiff; Container c; public void mouseDragged(MouseEvent e) { c = GrabAndScrollLabel.this.getParent(); if (c instanceof JViewport) { JViewport jv = (JViewport) c; Point p = jv.getViewPosition(); int newX = p.x - (e.getX() - xDiff); int newY = p.y - (e.getY() - yDiff); int maxX = GrabAndScrollLabel.this.getWidth() - jv.getWidth(); int maxY = GrabAndScrollLabel.this.getHeight() - jv.getHeight(); if (newX < 0) newX = 0; if (newX > maxX) newX = maxX; if (newY < 0) newY = 0; if (newY > maxY) newY = maxY; jv.setViewPosition(new Point(newX, newY)); } } public void mousePressed(MouseEvent e) { setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); xDiff = e.getX(); yDiff = e.getY(); } public void mouseReleased(MouseEvent e) { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }; addMouseMotionListener(mia); addMouseListener(mia); }
From source file:playground.sergioo.capacitiesChanger2012.gui.NetworkPanel.java
@Override public void mouseDragged(MouseEvent e) { camera.move(iniX - e.getX(), iniY - e.getY()); iniX = e.getX(); iniY = e.getY(); repaint(); }
From source file:playground.sergioo.networkBusLaneAdder2012.gui.BusLaneAdderPanel.java
@Override public void mouseMoved(MouseEvent e) { double[] p = getWorld(e.getX(), e.getY()); busLaneAdderWindow.setCoords(p[0], p[1]); }
From source file:GrabAndDragDemo.java
public GrabAndScrollLabel(ImageIcon i) { super(i);//from www . j a v a2s .c o m MouseInputAdapter mia = new MouseInputAdapter() { int xDiff, yDiff; boolean isDragging; Container c; public void mouseDragged(MouseEvent e) { c = GrabAndScrollLabel.this.getParent(); if (c instanceof JViewport) { JViewport jv = (JViewport) c; Point p = jv.getViewPosition(); int newX = p.x - (e.getX() - xDiff); int newY = p.y - (e.getY() - yDiff); int maxX = GrabAndScrollLabel.this.getWidth() - jv.getWidth(); int maxY = GrabAndScrollLabel.this.getHeight() - jv.getHeight(); if (newX < 0) newX = 0; if (newX > maxX) newX = maxX; if (newY < 0) newY = 0; if (newY > maxY) newY = maxY; jv.setViewPosition(new Point(newX, newY)); } } public void mousePressed(MouseEvent e) { setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); xDiff = e.getX(); yDiff = e.getY(); } public void mouseReleased(MouseEvent e) { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }; addMouseMotionListener(mia); addMouseListener(mia); }
From source file:ucar.unidata.idv.control.chart.RangeFilter.java
/** * Set the position from the mouse/* w w w.j ava2s . c o m*/ * * @param event mouse event */ public void setPosition(MouseEvent event) { int diff = event.getY() - y; setPosition(event.getX(), event.getY()); if ((attached != null) && event.isShiftDown()) { attached.setPosition(event.getX(), attached.y + diff); } }
From source file:playground.sergioo.capacitiesChanger2012.gui.NetworkPanel.java
@Override public void mousePressed(MouseEvent e) { this.requestFocus(); iniX = e.getX(); iniY = e.getY(); }
From source file:com.iisigroup.ris.WebFileScanUtilBrowserUI.java
/** * Auto-generated method for setting the popup menu for a component *//* ww w . j a va2 s .co m*/ private void setComponentPopupMenu(final java.awt.Component parent, final javax.swing.JPopupMenu menu) { parent.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent e) { if (e.isPopupTrigger()) menu.show(parent, e.getX(), e.getY()); } public void mouseReleased(java.awt.event.MouseEvent e) { if (e.isPopupTrigger()) menu.show(parent, e.getX(), e.getY()); } }); }