List of usage examples for java.awt.event MouseEvent getY
public int getY()
From source file:ucar.unidata.idv.control.chart.ChartAnnotation.java
/** * Set the position to the x/y of the event * * @param event The event/*w ww .j a va2 s. c o m*/ */ public void setPosition(MouseEvent event) { setPosition(event.getX(), event.getY()); }
From source file:com.diversityarrays.kdxplore.chartcommon.KDXploreChartPanel.java
@Override public void mouseReleased(MouseEvent e) { if (e.isShiftDown() || shiftDownatStart) { super.mouseReleased(e); shiftDownatStart = false;//from w w w . jav a 2 s.c om Insets insets = getInsets(); int x = (int) ((e.getX() - insets.left) / this.getScaleX()); int y = (int) ((e.getY() - insets.top) / this.getScaleY()); ChartEntity entity = null; if (this.getChartRenderingInfo() != null) { EntityCollection entities = this.getChartRenderingInfo().getEntityCollection(); if (entities != null) { entity = entities.getEntity(x, y); } } Object[] listeners = this.getListeners(ChartMouseListener.class); if (this.getChart() != null) { ChartMouseEvent event = new ChartMouseEvent(getChart(), e, entity); for (int i = listeners.length - 1; i >= 0; i -= 1) { if (listeners[i] instanceof KDXChartMouseListener) { ((KDXChartMouseListener) listeners[i]).chartMouseZoomingReleased(event); } } } } else { super.mouseReleased(e); Insets insets = getInsets(); int x = (int) ((e.getX() - insets.left) / this.getScaleX()); int y = (int) ((e.getY() - insets.top) / this.getScaleY()); ChartEntity entity = null; if (this.getChartRenderingInfo() != null) { EntityCollection entities = this.getChartRenderingInfo().getEntityCollection(); if (entities != null) { entity = entities.getEntity(x, y); } } Object[] listeners = this.getListeners(ChartMouseListener.class); if (this.getChart() != null) { ChartMouseEvent event = new ChartMouseEvent(getChart(), e, entity); for (int i = listeners.length - 1; i >= 0; i -= 1) { if (listeners[i] instanceof KDXChartMouseListener) { ((KDXChartMouseListener) listeners[i]).chartMouseSelectedReleased(event); } } } } }
From source file:net.sf.mzmine.desktop.impl.projecttree.ProjectTreeMouseHandler.java
private void handleDoubleClickEvent(MouseEvent e) { TreePath clickedPath = tree.getPathForLocation(e.getX(), e.getY()); if (clickedPath == null) return;/*from w ww . j a va2 s . c om*/ DefaultMutableTreeNode node = (DefaultMutableTreeNode) clickedPath.getLastPathComponent(); Object clickedObject = node.getUserObject(); if (clickedObject instanceof RawDataFile) { RawDataFile clickedFile = (RawDataFile) clickedObject; TICVisualizerModule.setupNewTICVisualizer(clickedFile); } if (clickedObject instanceof PeakList) { PeakList clickedPeakList = (PeakList) clickedObject; PeakListTableModule.showNewPeakListVisualizerWindow(clickedPeakList); } if (clickedObject instanceof Scan) { Scan clickedScan = (Scan) clickedObject; SpectraVisualizerModule.showNewSpectrumWindow(clickedScan.getDataFile(), clickedScan.getScanNumber()); } if (clickedObject instanceof MassList) { MassList clickedMassList = (MassList) clickedObject; Scan clickedScan = clickedMassList.getScan(); SpectraVisualizerWindow window = SpectraVisualizerModule .showNewSpectrumWindow(clickedScan.getDataFile(), clickedScan.getScanNumber()); MassListDataSet dataset = new MassListDataSet(clickedMassList); window.addDataSet(dataset, Color.green); } if (clickedObject instanceof PeakListRow) { PeakListRow clickedPeak = (PeakListRow) clickedObject; PeakSummaryVisualizerModule.showNewPeakSummaryWindow(clickedPeak); } }
From source file:net.rptools.tokentool.ui.TokenCompositionPanel.java
public void mouseDragged(MouseEvent e) { int dx = e.getX() - dragStartX; int dy = e.getY() - dragStartY; dragStartX = e.getX();//from www .ja v a 2 s .co m dragStartY = e.getY(); tokenOffsetX += dx; tokenOffsetY += dy; repaint(); fireCompositionChanged(); }
From source file:MouseClickListener.java
public void mouseClicked(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e)) { System.out.print("The mouse left button was clicked"); } else if (SwingUtilities.isRightMouseButton(e)) { System.out.print("The mouse right button was clicked"); } else if (SwingUtilities.isMiddleMouseButton(e)) { System.out.print("The mouse middle button was clicked"); }//from w w w.ja v a2 s. c o m System.out.print(e.getClickCount() + "time(s)"); int x = e.getX(); int y = e.getY(); System.out.println(" at (" + x + "," + y + ")"); }
From source file:hwcdhackwaterloo.GUIMain.java
/** * Creates new form NewJFrame//from w w w . j a v a2s . c o m */ public GUIMain() { initComponents(); menuPanel.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { posX = e.getX(); posY = e.getY(); } }); menuPanel.addMouseMotionListener(new MouseAdapter() { public void mouseDragged(MouseEvent evt) { //sets frame position when mouse dragged setLocation(evt.getXOnScreen() - posX, evt.getYOnScreen() - posY); } }); }
From source file:org.eevolution.form.VCRPDetail.java
private void handleTreeEvent(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3) { model.getTree().setSelectionPath(model.getTree().getPathForLocation(e.getX(), e.getY())); DefaultMutableTreeNode node = (DefaultMutableTreeNode) model.getTree().getSelectionPath() .getLastPathComponent(); if (!(node.getUserObject() instanceof Date) && !(node.getUserObject() instanceof MPPOrderNode)) { popup.show(e.getComponent(), e.getX(), e.getY()); }/*from ww w. ja v a2s . c o m*/ } SwingTool.setCursorsFromChild(e.getComponent(), false); }
From source file:com.cmsoftware.keyron.vista.Login.java
private void panelContenidoMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_panelContenidoMousePressed yAnterior = evt.getY(); xAnterior = evt.getX();/*from ww w.j a v a 2 s .c o m*/ this.setCursor(new Cursor(Cursor.MOVE_CURSOR)); }
From source file:Main.java
public void mouseClicked(MouseEvent evt) { JTable table = ((JTableHeader) evt.getSource()).getTable(); TableColumnModel colModel = table.getColumnModel(); int index = colModel.getColumnIndexAtX(evt.getX()); if (index == -1) { return;//from w w w . j a v a 2 s .co m } Rectangle headerRect = table.getTableHeader().getHeaderRect(index); if (index == 0) { headerRect.width -= 10; } else { headerRect.grow(-10, 0); } if (!headerRect.contains(evt.getX(), evt.getY())) { int vLeftColIndex = index; if (evt.getX() < headerRect.x) { vLeftColIndex--; } } }
From source file:medsavant.enrichment.app.RegionListAggregatePanel.java
private void createSearchableTable() { tablePanel = new SearchableTablePanel(pageName, new String[] { "Name", "Chromosome", "Start", "End", "Length", "Variants", "Variants / KB", "Individuals" }, new Class[] { String.class, String.class, Integer.class, Integer.class, Integer.class, Integer.class, Double.class, Integer.class }, new int[0], true, true, Integer.MAX_VALUE, false, SearchableTablePanel.TableSelectionType.ROW, Integer.MAX_VALUE, new AggregationRetriever()); tablePanel.getTable().addMouseListener(new MouseAdapter() { @Override//from w w w. j ava2 s.co m public void mouseReleased(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) { createPopup().show(e.getComponent(), e.getX(), e.getY()); } } }); showShowCard(); }