List of usage examples for java.awt.event MouseEvent getY
public int getY()
From source file:com.sshtools.sshterm.SshTermSessionPanel.java
/** * * * @param e/*from ww w . java2 s .c o m*/ */ public void mouseMoved(MouseEvent e) { if (isAutoHideTools()) { if (!isToolsVisible() && (e.getY() < 4)) { setToolsVisible(true); } else if (isToolsVisible() && (e.getY() > 12)) { setToolsVisible(false); } if (!scrollBar.isVisible() && (e.getX() > (getWidth() - 4))) { setScrollBarVisible(true); } else if (scrollBar.isVisible() && (e.getX() < (getWidth() - 12))) { setScrollBarVisible(false); } } }
From source file:canreg.client.gui.analysis.FrequenciesByYearInternalFrame.java
private void columnTableMousePressed(java.awt.event.MouseEvent evt) { if (evt.getButton() == java.awt.event.MouseEvent.BUTTON3) { JTable target = (JTable) evt.getSource(); int columnNumber = target.getSelectedColumn(); JPopupMenu jpm = new JPopupMenu("" + columnNumber); jpm.add(java.util.ResourceBundle .getBundle("canreg/client/gui/analysis/resources/FrequenciesByYearInternalFrame") .getString("COLUMN ") + tableColumnModel.getColumn(tableColumnModel.getColumnIndexAtX(evt.getX())).getHeaderValue()); jpm.show(target, evt.getX(), evt.getY()); }/*from www .j av a2 s . c om*/ }
From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.link_and_brush.LinkAndBrushChartPanel.java
@Override public void mouseDragged(MouseEvent e) { // when not allowed to zoom / select, return if (blockSelectionOrZoom) { return;// w ww . j a va2 s . co m } // if the popup menu has already been triggered, then ignore dragging... if (getChartFieldValueByName("popup") != null && ((JPopupMenu) getChartFieldValueByName("popup")).isShowing()) { return; } // handle panning if we have a start point if (getChartFieldValueByName("panLast") != null) { double dx = e.getX() - ((Point) getChartFieldValueByName("panLast")).getX(); double dy = e.getY() - ((Point) getChartFieldValueByName("panLast")).getY(); if (dx == 0.0 && dy == 0.0) { return; } double wPercent = -dx / ((Double) getChartFieldValueByName("panW")); double hPercent = dy / ((Double) getChartFieldValueByName("panH")); boolean old = getChart().getPlot().isNotify(); getChart().getPlot().setNotify(false); Pannable p = (Pannable) getChart().getPlot(); if (p.getOrientation() == PlotOrientation.VERTICAL) { p.panDomainAxes(wPercent, getChartRenderingInfo().getPlotInfo(), (Point) getChartFieldValueByName("panLast")); p.panRangeAxes(hPercent, getChartRenderingInfo().getPlotInfo(), (Point) getChartFieldValueByName("panLast")); } else { p.panDomainAxes(hPercent, getChartRenderingInfo().getPlotInfo(), (Point) getChartFieldValueByName("panLast")); p.panRangeAxes(wPercent, getChartRenderingInfo().getPlotInfo(), (Point) getChartFieldValueByName("panLast")); } setChartFieldValue((getChartFieldByName("panLast")), e.getPoint()); getChart().getPlot().setNotify(old); return; } // if no initial zoom point was set, ignore dragging... if (getChartFieldValueByName("zoomPoint") == null) { return; } Graphics2D g2 = (Graphics2D) getGraphics(); // erase the previous zoom rectangle (if any). We only need to do // this is we are using XOR mode, which we do when we're not using // the buffer (if there is a buffer, then at the end of this method we // just trigger a repaint) if (!(Boolean) getChartFieldValueByName("useBuffer")) { drawZoomRectangle(g2, true); } boolean hZoom = false; boolean vZoom = false; if ((PlotOrientation) getChartFieldValueByName("orientation") == PlotOrientation.HORIZONTAL) { hZoom = (Boolean) getChartFieldValueByName("rangeZoomable"); vZoom = (Boolean) getChartFieldValueByName("domainZoomable"); } else { hZoom = (Boolean) getChartFieldValueByName("domainZoomable"); vZoom = (Boolean) getChartFieldValueByName("rangeZoomable"); } Point2D zoomPoint = (Point2D) getChartFieldValueByName("zoomPoint"); Rectangle2D scaledDataArea = getScreenDataArea((int) zoomPoint.getX(), (int) zoomPoint.getY()); if (hZoom && vZoom) { // selected rectangle shouldn't extend outside the data area... double xmax = Math.min(e.getX(), scaledDataArea.getMaxX()); double ymax = Math.min(e.getY(), scaledDataArea.getMaxY()); setChartFieldValue(getChartFieldByName("zoomRectangle"), new Rectangle2D.Double(zoomPoint.getX(), zoomPoint.getY(), xmax - zoomPoint.getX(), ymax - zoomPoint.getY())); } else if (hZoom) { double xmax = Math.min(e.getX(), scaledDataArea.getMaxX()); setChartFieldValue(getChartFieldByName("zoomRectangle"), new Rectangle2D.Double(zoomPoint.getX(), scaledDataArea.getMinY(), xmax - zoomPoint.getX(), scaledDataArea.getHeight())); } else if (vZoom) { double ymax = Math.min(e.getY(), scaledDataArea.getMaxY()); setChartFieldValue(getChartFieldByName("zoomRectangle"), new Rectangle2D.Double(scaledDataArea.getMinX(), zoomPoint.getY(), scaledDataArea.getWidth(), ymax - zoomPoint.getY())); } // Draw the new zoom rectangle... if ((Boolean) getChartFieldValueByName("useBuffer")) { repaint(); } else { // with no buffer, we use XOR to draw the rectangle "over" the // chart... drawZoomRectangle(g2, true); } g2.dispose(); }
From source file:mulavito.gui.control.AbstractPopupMousePlugin.java
/** * Reduced functionality of super class method and extended by own * content-aware editing.// w w w . jav a2s.c o m */ @SuppressWarnings("unchecked") @Override protected final void handlePopup(final MouseEvent e) { if (checkModifiers(e)) { final LV vv = (LV) e.getSource(); final Layout<V, E> layout = vv.getGraphLayout(); final L graph = (L) layout.getGraph(); final Point p = e.getPoint(); final List<V> sel_vertices = getSelectedVertices(); final List<E> sel_edges = getSelectedEdges(); GraphElementAccessor<V, E> pickSupport = vv.getPickSupport(); if (pickSupport != null) { V vertex = pickSupport.getVertex(layout, p.getX(), p.getY()); E edge = pickSupport.getEdge(layout, p.getX(), p.getY()); if (vertex != null && !sel_vertices.contains(vertex)) sel_vertices.add(vertex); if (edge != null && !sel_edges.contains(edge)) sel_edges.add(edge); } popup.removeAll(); if (sel_vertices.size() > 0) createVertexMenuEntries(p, graph, vv, sel_vertices); else if (sel_edges.size() > 0) createEdgeMenuEntries(p, graph, vv, sel_edges); else createGeneralMenuEntries(p, graph, vv); if (popup.getComponentCount() > 0) popup.show(vv, e.getX(), e.getY()); } }
From source file:com.floreantpos.jasperreport.swing.JRViewerPanel.java
void pnlLinksMouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_pnlLinksMouseDragged // Add your handling code here: Container container = pnlInScroll.getParent(); if (container instanceof JViewport) { JViewport viewport = (JViewport) container; Point point = viewport.getViewPosition(); int newX = point.x - (evt.getX() - downX); int newY = point.y - (evt.getY() - downY); int maxX = pnlInScroll.getWidth() - viewport.getWidth(); int maxY = pnlInScroll.getHeight() - viewport.getHeight(); if (newX < 0) { newX = 0;/*from w ww . j av a 2 s . c o m*/ } if (newX > maxX) { newX = maxX; } if (newY < 0) { newY = 0; } if (newY > maxY) { newY = maxY; } viewport.setViewPosition(new Point(newX, newY)); } }
From source file:com.jcraft.weirdx.DDXWindowImpSwing.java
private void procPressed(MouseEvent e) { int x = e.getX() + window.x; int y = e.getY() + window.y; XWindow.sprite.hot.x = x;//w ww. j a v a 2 s.c o m XWindow.sprite.hot.y = y; int mod = e.getModifiers(); if (mod == 0) { mod |= InputEvent.BUTTON1_MASK; } // ????? int state = 0; int detail = 1; if ((mod & InputEvent.BUTTON1_MASK) != 0) detail = 1; if ((mod & InputEvent.BUTTON2_MASK) != 0) detail = 2; if ((mod & InputEvent.BUTTON3_MASK) != 0) detail = 3; if ((mod & InputEvent.SHIFT_MASK) != 0) state |= 1; if ((mod & InputEvent.CTRL_MASK) != 0) state |= 4; // alt -> state|=8; Event.filters[Event.MotionNotify] = Event.PointerMotionMask | Event.ButtonMotionMask | ((Event.Button1Mask >> 1) << detail); event.mkButtonPress(detail, window.screen.rootId, window.id, 0, x, y, e.getX(), e.getY(), state, 1); try { if (XWindow.grab == null) { if (XWindow.checkDeviceGrabs(event, 0, 1)) { return; } } if (XWindow.grab != null) XWindow.sendGrabbedEvent(event, false, 1); else XWindow.sendDeviceEvent(window, event, XWindow.grab, null, 1); } catch (Exception ee) { } if ((mod & InputEvent.BUTTON1_MASK) != 0) { state |= (1 << 8); } if ((mod & InputEvent.BUTTON2_MASK) != 0) { state |= (1 << 9); } if ((mod & InputEvent.BUTTON3_MASK) != 0) { state |= (1 << 10); } // if((mod & InputEvent.SHIFT_MASK)!=0) state|=1; // if((mod & InputEvent.CTRL_MASK)!=0) state|=4; // alt -> state|=8; XWindow.sprite.hot.state = state; }
From source file:brainflow.app.toplevel.BrainFlow.java
private void showActionMenu(MouseEvent e) { Component c = SwingUtilities.getDeepestComponentAt(e.getComponent(), e.getX(), e.getY()); java.util.List<Action> actionList = new ArrayList<Action>(); while (true) { if (c instanceof IActionProvider) { IActionProvider provider = (IActionProvider) c; provider.addActions(e, actionList); } else if (c instanceof JComponent) { JComponent jc = (JComponent) c; Object provider = jc.getClientProperty(IActionProvider.KEY); if (provider != null) { ((IActionProvider) provider).addActions(e, actionList); }//from w w w. j a v a 2 s .com } Component p = c.getParent(); if (p != null) { c = p; } else { break; } } if (actionList.size() > 0) { createPopup(actionList).setVisible(true); } }
From source file:com.jcraft.weirdx.DDXWindowImp.java
public void mouseMoved(MouseEvent e) { int x = e.getX() + window.x; int y = e.getY() + window.y; XWindow.sprite.hot.x = x;//from w ww . ja v a 2 s . c om XWindow.sprite.hot.y = y; int mod = e.getModifiers(); int state = 0; px = x; py = y; if ((mod & InputEvent.BUTTON1_MASK) != 0) state |= (1 << 8); if ((mod & InputEvent.BUTTON2_MASK) != 0) state |= (1 << 9); if ((mod & InputEvent.BUTTON3_MASK) != 0) state |= (1 << 10); if ((mod & InputEvent.SHIFT_MASK) != 0) state |= 1; if ((mod & InputEvent.CTRL_MASK) != 0) state |= 4; // alt -> state|=8; XWindow.sprite.hot.state = state; event.mkMotionNotify(0, window.screen.rootId, window.id, 0, x, y, x - window.x, y - window.y, state, 1); try { if (!XWindow.checkMotion(event, window)) { return; } if (XWindow.grab != null) XWindow.sendGrabbedEvent(event, false, 1); else XWindow.sendDeviceEvent(window, event, XWindow.grab, null, 1); } catch (Exception ee) { } }
From source file:com.jcraft.weirdx.DDXWindowImp.java
private void procReleased(MouseEvent e) { int x = e.getX() + window.x; int y = e.getY() + window.y; XWindow.sprite.hot.x = x;/*ww w.ja v a 2s . com*/ XWindow.sprite.hot.y = y; int mod = e.getModifiers(); int state = 0; int detail = 0; if ((mod & InputEvent.BUTTON1_MASK) != 0) { state |= (1 << 8); detail = 1; } if ((mod & InputEvent.BUTTON2_MASK) != 0) { state |= (1 << 9); detail = 2; } if ((mod & InputEvent.BUTTON3_MASK) != 0) { state |= (1 << 10); detail = 3; } if ((mod & InputEvent.SHIFT_MASK) != 0) state |= 1; if ((mod & InputEvent.CTRL_MASK) != 0) state |= 4; // alt -> state|=8; XWindow.sprite.hot.state = 0; // ????? Event.filters[Event.MotionNotify] = Event.PointerMotionMask/*| ((Event.Button1Mask>>1)<<detail)*/; event.mkButtonRelease(detail, window.screen.rootId, window.id, 0, x, y, e.getX(), e.getY(), state, 1); try { if (XWindow.grab != null) XWindow.sendGrabbedEvent(event, true, 1); else XWindow.sendDeviceEvent(window, event, XWindow.grab, null, 1); } catch (Exception ee) { } XWindow.grab = null; }
From source file:com.mirth.connect.client.ui.DashboardPanel.java
/** * Shows the popup menu when the trigger button (right-click) has been pushed. Deselects the * rows if no row was selected.// w w w .j a v a2s. c om */ private void checkSelectionAndPopupMenu(MouseEvent event) { TreePath path = dashboardTable.getPathForLocation(event.getX(), event.getY()); /* * On mouse events we don't need to update the dashboard panel plugins. They will already * have been updated because of the ListSelectionEvent, and multiple mouse events will enter * here (as many as three, one pressed and two released) so we would basically be doing four * times the work. */ if (path == null) { deselectRows(false); } else { updatePopupMenu(false); } if (event.isPopupTrigger()) { TreeSelectionModel selectionModel = dashboardTable.getTreeSelectionModel(); if (!selectionModel.isPathSelected(path)) { deselectRows(false); selectionModel.addSelectionPath(path); } parent.dashboardPopupMenu.show(event.getComponent(), event.getX(), event.getY()); } }