List of usage examples for java.awt.event MouseEvent BUTTON3
int BUTTON3
To view the source code for java.awt.event MouseEvent BUTTON3.
Click Source Link
From source file:org.fhcrc.cpl.viewer.mrm.utilities.MRMerMouseListener.java
public void mouseExited(MouseEvent e) { if ((e.isShiftDown() || e.getButton() == MouseEvent.BUTTON3) || shifted) { } else {/*from w w w . ja va 2s .c o m*/ _cp.mouseExited(e); } }
From source file:org.apache.syncope.ide.netbeans.view.ResourceExplorerTopComponent.java
private void resourceExplorerTreeMouseClicked(final java.awt.event.MouseEvent evt) { if (evt.getButton() == MouseEvent.BUTTON1 && evt.getClickCount() == 2) { DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) resourceExplorerTree .getLastSelectedPathComponent(); DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) selectedNode.getParent(); String parentNodeName = parentNode == null ? null : String.valueOf(parentNode.getUserObject()); if (selectedNode.isLeaf() && StringUtils.isNotBlank(parentNodeName)) { String leafNodeName = (String) selectedNode.getUserObject(); try { if (PluginConstants.MAIL_TEMPLATES.equals(parentNodeName)) { openMailEditor(leafNodeName); } else if (PluginConstants.REPORT_XSLTS.equals(parentNodeName)) { openReportEditor(leafNodeName); }/* w w w .j av a 2s. co m*/ } catch (IOException e) { Exceptions.printStackTrace(e); } } } else if (evt.getButton() == MouseEvent.BUTTON3 && evt.getClickCount() == 1) { DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) resourceExplorerTree .getLastSelectedPathComponent(); String selectedNodeName = (String) selectedNode.getUserObject(); if (selectedNode.isLeaf() && !PluginConstants.ROOT_NAME.equals(selectedNodeName) && !PluginConstants.MAIL_TEMPLATES.equals(selectedNodeName) && !PluginConstants.REPORT_XSLTS.equals(selectedNodeName)) { leafRightClickAction(evt, selectedNode); } else if (PluginConstants.MAIL_TEMPLATES.equals(selectedNodeName)) { folderRightClickAction(evt, mailTemplates); } else if (PluginConstants.REPORT_XSLTS.equals(selectedNodeName)) { folderRightClickAction(evt, reportXslts); } else if (PluginConstants.ROOT_NAME.equals(selectedNodeName)) { rootRightClickAction(evt); } } }
From source file:org.ujmp.jung.JungVisualizationViewer.java
public final void mouseClicked(MouseEvent e) { switch (e.getButton()) { case MouseEvent.BUTTON1: break;/*from w w w . j a va 2 s .c om*/ case MouseEvent.BUTTON2: break; case MouseEvent.BUTTON3: JPopupMenu popup = null; popup = new JungGraphActions(this); popup.show(e.getComponent(), e.getX(), e.getY()); break; } }
From source file:gg.pistol.sweeper.gui.component.DecoratedPanel.java
/** * Helper method to add a contextual menu on a text component that will allow for Copy & Select All text actions. *//*from w ww . j av a 2 s . c om*/ protected void addCopyMenu(final JTextComponent component) { Preconditions.checkNotNull(component); if (!component.isEditable()) { component.setCursor(new Cursor(Cursor.TEXT_CURSOR)); } final JPopupMenu contextMenu = new JPopupMenu(); JMenuItem copy = new JMenuItem(component.getActionMap().get(DefaultEditorKit.copyAction)); copy.setText(i18n.getString(I18n.TEXT_COPY_ID)); contextMenu.add(copy); contextMenu.addSeparator(); JMenuItem selectAll = new JMenuItem(component.getActionMap().get(DefaultEditorKit.selectAllAction)); selectAll.setText(i18n.getString(I18n.TEXT_SELECT_ALL_ID)); contextMenu.add(selectAll); component.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3) { contextMenu.show(component, e.getX(), e.getY()); } } }); }
From source file:net.sf.jabref.gui.MainTableSelectionListener.java
@Override public void mouseReleased(MouseEvent e) { // First find the column and row on which the user has clicked. final int col = table.columnAtPoint(e.getPoint()); final int row = table.rowAtPoint(e.getPoint()); // Check if the user has clicked on an icon cell to open url or pdf. final String[] iconType = table.getIconTypeForColumn(col); // Check if the user has right-clicked. If so, open the right-click menu. if (e.isPopupTrigger() || (e.getButton() == MouseEvent.BUTTON3)) { if (iconType == null) { processPopupTrigger(e, row); } else {/* w w w . j a v a2s. com*/ showIconRightClickMenu(e, row, iconType); } } }
From source file:org.fhcrc.cpl.viewer.mrm.utilities.MRMerMouseListener.java
public void mouseDragged(MouseEvent e) { if ((e.isShiftDown() || e.getButton() == MouseEvent.BUTTON3) || shifted) { if (this.coElutionStart == null) { return; }//from ww w . j a v a 2 s . c om Graphics2D g2 = (Graphics2D) _cp.getGraphics(); if (this.coElutionRegion != null) drawCoElutionRegion(g2); if (e.getX() < this.coElutionStart.getX()) return; // Erase the previous zoom rectangle (if any)... Rectangle2D scaledDataArea = _cp.getScreenDataArea((int) this.coElutionStart.getX(), (int) this.coElutionStart.getY()); // 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()); /* this.coElutionRegion = new Rectangle2D.Double( this.coElutionStart.getX(), this.coElutionStart.getY(), xmax - this.coElutionStart.getX(), ymax - this.coElutionStart.getY()); */ this.coElutionRegion = new Rectangle2D.Double(this.coElutionStart.getX(), scaledDataArea.getMinY(), Math.abs(e.getX() - coElutionStart.getX()), scaledDataArea.getHeight()); // Draw the new zoom rectangle... drawCoElutionRegion(g2); g2.dispose(); } else { _cp.mouseDragged(e); } }
From source file:net.sf.jabref.gui.maintable.MainTableSelectionListener.java
@Override public void mouseReleased(MouseEvent e) { // First find the column and row on which the user has clicked. final int col = table.columnAtPoint(e.getPoint()); final int row = table.rowAtPoint(e.getPoint()); // get the MainTableColumn which is currently visible at col int modelIndex = table.getColumnModel().getColumn(col).getModelIndex(); MainTableColumn modelColumn = table.getMainTableColumn(modelIndex); // Check if the user has right-clicked. If so, open the right-click menu. if (e.isPopupTrigger() || (e.getButton() == MouseEvent.BUTTON3)) { if ((modelColumn == null) || !modelColumn.isIconColumn()) { // show normal right click menu processPopupTrigger(e, row); } else {/*from w w w .j av a 2 s.c o m*/ // show right click menu for icon columns showIconRightClickMenu(e, row, modelColumn); } } }
From source file:playground.sergioo.networkBusLaneAdder2012.gui.BusLaneAdderPanel.java
@Override public void mouseClicked(MouseEvent e) { double[] p = getWorld(e.getX(), e.getY()); if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON3) camera.centerCamera(p);//from w w w . j av a 2s . c om else { if (busLaneAdderWindow.getOption().equals(Options.SELECT_NODES) && e.getButton() == MouseEvent.BUTTON1) { ((NetworkTwoNodesPainterManager) ((NetworkPainter) getActiveLayer().getPainter()) .getNetworkPainterManager()).selectNearestNode(p[0], p[1]); busLaneAdderWindow.refreshLabel(Labels.NODES); } else if (busLaneAdderWindow.getOption().equals(Options.SELECT_NODES) && e.getButton() == MouseEvent.BUTTON3) { ((NetworkTwoNodesPainterManager) ((NetworkPainter) getActiveLayer().getPainter()) .getNetworkPainterManager()).unselectNearestNode(p[0], p[1]); busLaneAdderWindow.refreshLabel(Labels.NODES); } else if (busLaneAdderWindow.getOption().equals(Options.ZOOM) && e.getButton() == MouseEvent.BUTTON1) { camera.zoomIn(p[0], p[1]); } else if (busLaneAdderWindow.getOption().equals(Options.ZOOM) && e.getButton() == MouseEvent.BUTTON3) { camera.zoomOut(p[0], p[1]); } } repaint(); }
From source file:com.univocity.app.swing.DataAnalysisWindow.java
private void addPopupMenuToTable(DaoTable daoTable, boolean isSourceTable) { String engineName = isSourceTable ? config.getSourceEngineName() : config.getDestinationEngineName(); if (engineName == null) { return;/* www .j av a 2 s. com*/ } final JTable table = daoTable.getDataTable(); final JPopupMenu menu = new JPopupMenu(); menu.add(newJMenuItem("Disable updates", daoTable, engineName, false, false)); menu.add(newJMenuItem("Enable updates", daoTable, engineName, true, false)); menu.add(new JSeparator()); menu.add(newJMenuItem("Disable updates on all rows", daoTable, engineName, false, true)); menu.add(newJMenuItem("Enable updates on all rows", daoTable, engineName, true, true)); table.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3) { int rowNumber = table.rowAtPoint(e.getPoint()); if (rowNumber != -1) { table.getSelectionModel().setSelectionInterval(rowNumber, rowNumber); menu.show(table, e.getX(), e.getY()); } } }; }); }
From source file:org.talend.dataprofiler.chart.TOPChartService.java
@Override public void addMouseListenerForChart(Object chartComposite, final Map<String, Object> menuMap, final boolean useRowFirst) { final ChartComposite chartComp = (ChartComposite) chartComposite; final ChartMouseListener listener = new ChartMouseListener() { @Override/*from w w w . j av a 2 s. c om*/ public void chartMouseClicked(ChartMouseEvent event) { boolean flag = event.getTrigger().getButton() != MouseEvent.BUTTON3; chartComp.setDomainZoomable(flag); chartComp.setRangeZoomable(flag); if (flag) { return; } ChartEntity chartEntity = event.getEntity(); if (chartEntity != null && chartEntity instanceof CategoryItemEntity) { CategoryItemEntity cateEntity = (CategoryItemEntity) chartEntity; Menu menu = getCurrentMenu(cateEntity); if (menu != null) { chartComp.setMenu(menu); menu.setVisible(true); } } } private Menu getCurrentMenu(CategoryItemEntity cateEntity) { if (useRowFirst) { return findCurrentMenu(cateEntity.getRowKey(), cateEntity.getColumnKey()); } else { return findCurrentMenu(cateEntity.getColumnKey(), cateEntity.getRowKey()); } } /** * DOC yyin Comment method "findCurrentMenu". * * @param firstKey * @param secondKey * @return */ private Menu findCurrentMenu(final Object firstKey, Object secondKey) { Object menu = menuMap.get(firstKey); if (menu != null) { return (Menu) menu; } menu = menuMap.get(secondKey); if (menu != null) { return (Menu) menu; } return null; } @Override public void chartMouseMoved(ChartMouseEvent event) { // no action here } }; chartComp.addChartMouseListener(listener); chartComp.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { chartComp.removeChartMouseListener(listener); chartComp.dispose(); } }); }