List of usage examples for java.awt.event MouseEvent getComponent
public Component getComponent()
From source file:org.executequery.gui.editor.QueryEditorPopupMenu.java
private void maybeShowPopup(MouseEvent e) { if (e.isPopupTrigger()) { show(e.getComponent(), e.getX(), e.getY()); } }
From source file:net.sf.mzmine.chartbasics.gui.swing.ChartGestureMouseAdapter.java
@Override public void mouseClicked(MouseEvent e) { if (gestureHandlers == null || gestureHandlers.isEmpty() || !(listensFor(Event.CLICK) || listensFor(Event.DOUBLE_CLICK))) return;/* w ww. j a va 2 s . co m*/ if (e.getComponent() instanceof ChartPanel) { ChartPanel chartPanel = (ChartPanel) e.getComponent(); ChartEntity entity = findChartEntity(chartPanel, e); ChartGesture.Entity gestureEntity = ChartGesture.getGestureEntity(entity); Button button = Button.getButton(e.getButton()); if (!e.isConsumed()) { // double clicked if (e.getClickCount() == 2) { // reset click count to handle double clicks quickly e.consume(); // handle event handleEvent(new ChartGestureEvent(chartPanel, e, entity, new ChartGesture(gestureEntity, Event.DOUBLE_CLICK, button))); } else if (e.getClickCount() == 1) { // handle event handleEvent(new ChartGestureEvent(chartPanel, e, entity, new ChartGesture(gestureEntity, Event.CLICK, button))); } } } }
From source file:org.spoutcraft.launcher.skin.ConsoleFrame.java
private void doPop(MouseEvent e) { ContextMenu menu = new ContextMenu(); menu.show(e.getComponent(), e.getX(), e.getY()); }
From source file:net.sf.jabref.gui.openoffice.StyleSelectDialog.java
private void tablePopup(MouseEvent e) { popup.show(e.getComponent(), e.getX(), e.getY()); }
From source file:org.ujmp.jung.JungVisualizationViewer.java
public final void mouseClicked(MouseEvent e) { switch (e.getButton()) { case MouseEvent.BUTTON1: break;// w w w . ja v a2 s. c o m 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:org.nekorp.workflow.desktop.view.AutoDamageView.java
private void contentMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_contentMouseReleased if (evt.isPopupTrigger()) { for (DamageDetailGraphicsView x : damageDetail) { Point punto = new Point(evt.getX(), evt.getY()); if (x.shapeContains(punto) && editable) { this.currentEdited = x; this.jPopupMenu1.show(evt.getComponent(), evt.getX(), evt.getY()); break; }// w w w. j a va2 s. c o m } } else { if (currentView.shapeContains(evt.getX() - boundsX, evt.getY() - boundsY) && editable) { damageCaptura.setX(evt.getX() - boundsX); damageCaptura.setY(evt.getY() - boundsY); dialogFactory.createDialog(mainFrame, true).setVisible(true); } } }
From source file:org.drugis.addis.gui.builder.NetworkMetaAnalysisView.java
private MouseAdapter treatmentCategorizationListener(final NetworkRelativeEffectTableCellRenderer renderer) { return new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() > 1) { JTable table = (JTable) e.getComponent(); int row = table.convertRowIndexToModel(table.rowAtPoint(e.getPoint())); int col = table.convertColumnIndexToModel(table.columnAtPoint(e.getPoint())); if (col == row) { Treatment treatment = renderer.getTreatment(table.getModel(), col); TreatmentDefinition treatmentDefinition = d_pm.getTreatmentDefinition(treatment); Category category = treatmentDefinition.getContents().first(); if (category != null && !category.isTrivial()) { d_mainWindow.leftTreeFocus(category.getCategorization()); }/*from w w w . j av a2 s. co m*/ } } } }; }
From source file:org.zaproxy.zap.extension.encoder2.EncodeDecodeDialog.java
private ZapTextArea newField(boolean editable) { final ZapTextArea field = new ZapTextArea(); field.setLineWrap(true);/* www . j a v a2s .co m*/ field.setBorder(BorderFactory.createEtchedBorder()); field.setEditable(editable); field.setName(ENCODE_DECODE_RESULTFIELD); field.addMouseListener(new java.awt.event.MouseAdapter() { @Override public void mousePressed(java.awt.event.MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) { View.getSingleton().getPopupMenu().show(e.getComponent(), e.getX(), e.getY()); } } }); return field; }
From source file:MouseTest.java
public MouseTest() { super();/*from ww w . ja v a 2 s . com*/ final JPopupMenu pop = new JPopupMenu(); pop.add(new JMenuItem("Cut")); pop.add(new JMenuItem("Copy")); pop.add(new JMenuItem("Paste")); pop.addSeparator(); pop.add(new JMenuItem("Select All")); pop.setInvoker(this); MouseListener popup = new MouseListener() { public void mouseClicked(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { if (e.isPopupTrigger()) { showPopup(e); } } public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger()) { showPopup(e); } } private void showPopup(MouseEvent e) { pop.show(e.getComponent(), e.getX(), e.getY()); } }; addMouseListener(popup); MouseListener drawing1 = new MouseListener() { public void mouseClicked(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { color = Color.RED; startX = endX = e.getX(); startY = endY = e.getY(); repaint(); } public void mouseReleased(MouseEvent e) { color = Color.BLACK; repaint(); } }; addMouseListener(drawing1); MouseMotionListener drawing2 = new MouseMotionListener() { public void mouseDragged(MouseEvent e) { endX = e.getX(); endY = e.getY(); repaint(); } public void mouseMoved(MouseEvent e) { } }; addMouseMotionListener(drawing2); }
From source file:com.quinsoft.zeidon.objectbrowser.EntitySquare.java
private void doPop(MouseEvent e) { EntityPopupMenu menu = new EntityPopupMenu(); menu.show(e.getComponent(), e.getX(), e.getY()); }