Example usage for java.awt.event MouseEvent BUTTON3

List of usage examples for java.awt.event MouseEvent BUTTON3

Introduction

In this page you can find the example usage for java.awt.event MouseEvent BUTTON3.

Prototype

int BUTTON3

To view the source code for java.awt.event MouseEvent BUTTON3.

Click Source Link

Document

Indicates mouse button #3; used by #getButton .

Usage

From source file:com.db2eshop.gui.component.tab.CustomerTab.java

/**
 * <p>registerMouseListener.</p>
 *
 * @param jScrollPane a {@link javax.swing.JScrollPane} object.
 * @param table a {@link com.db2eshop.gui.component.table.api.GenericTable} object.
 *///from ww w.  ja  v a  2  s  . co m
public void registerMouseListener(JScrollPane jScrollPane, GenericTable<?> table) {
    jScrollPane.addMouseListener(new BaseMouseListener() {
        @Override
        public void mouseClicked(MouseEvent arg0) {
            if (arg0.getButton() == MouseEvent.BUTTON3) {
                tabRightClickPopupMenu.showMenu(arg0.getPoint(), null, null, customerTable);
            }
        }
    });
}

From source file:com.db2eshop.gui.component.tab.EmployeeTab.java

/**
 * <p>registerMouseListener.</p>
 *
 * @param jScrollPane a {@link javax.swing.JScrollPane} object.
 * @param table a {@link com.db2eshop.gui.component.table.api.GenericTable} object.
 *///from w  w  w  .jav  a  2s .co m
public void registerMouseListener(JScrollPane jScrollPane, GenericTable<?> table) {
    jScrollPane.addMouseListener(new BaseMouseListener() {
        @Override
        public void mouseClicked(MouseEvent arg0) {
            if (arg0.getButton() == MouseEvent.BUTTON3) {
                tabRightClickPopupMenu.showMenu(arg0.getPoint(), null, null, employeeTable);
            }
        }
    });
}

From source file:com.db2eshop.gui.component.tab.SupplierTab.java

/**
 * <p>registerMouseListener.</p>
 *
 * @param jScrollPane a {@link javax.swing.JScrollPane} object.
 * @param table a {@link com.db2eshop.gui.component.table.api.GenericTable} object.
 *///from w ww .j av a  2 s. c o  m
public void registerMouseListener(JScrollPane jScrollPane, GenericTable<?> table) {
    jScrollPane.addMouseListener(new BaseMouseListener() {
        @Override
        public void mouseClicked(MouseEvent arg0) {
            if (arg0.getButton() == MouseEvent.BUTTON3) {
                tabRightClickPopupMenu.showMenu(arg0.getPoint(), null, null, supplierTable);
            }
        }
    });
}

From source file:com.db2eshop.gui.component.tab.ShippingTab.java

/**
 * <p>registerMouseListener.</p>
 *
 * @param jScrollPane a {@link javax.swing.JScrollPane} object.
 * @param table a {@link com.db2eshop.gui.component.table.api.GenericTable} object.
 *///  w  w w  .j  a v a 2s  . com
public void registerMouseListener(JScrollPane jScrollPane, GenericTable<?> table) {
    jScrollPane.addMouseListener(new BaseMouseListener() {
        @Override
        public void mouseClicked(MouseEvent arg0) {
            if (arg0.getButton() == MouseEvent.BUTTON3) {
                tabRightClickPopupMenu.showMenu(arg0.getPoint(), null, null, shippingTable);
            }
        }
    });
}

From source file:com.db2eshop.gui.component.tab.ArticleTypeTab.java

/**
 * <p>registerMouseListener.</p>
 *
 * @param jScrollPane a {@link javax.swing.JScrollPane} object.
 * @param table a {@link com.db2eshop.gui.component.table.api.GenericTable} object.
 *///  ww  w.j a v a  2  s . c o  m
public void registerMouseListener(JScrollPane jScrollPane, GenericTable<?> table) {
    jScrollPane.addMouseListener(new BaseMouseListener() {
        @Override
        public void mouseClicked(MouseEvent arg0) {
            if (arg0.getButton() == MouseEvent.BUTTON3) {
                tabRightClickPopupMenu.showMenu(arg0.getPoint(), null, null, articleTypeTable);
            }
        }
    });
}

From source file:com.sec.ose.osi.ui.frm.main.report.project.JListProjectWithPopup.java

private void initialize() {
    this.addListSelectionListener(new FileSelectionListener());
    this.addMouseListener(new MouseAdapter() {
        @SuppressWarnings("deprecation")
        public void mouseClicked(MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON3) {
                log.debug("JLIstProjectWithPop.mouseClicked() : MouseEvent.BUTTON3");
                /// clicked right button
                mEventHandler.handle(EventHandler.RIGHT_BTN_CLICKED);

                if (JListProjectWithPopup.this.getSelectedValues() != null // existed selected item
                        && JListProjectWithPopup.this.getSelectedValues().length > 0) {
                    log.debug("button3");
                    mPopup.show(e.getComponent(), e.getX(), e.getY());
                }/*w  ww . j  a  va  2  s  .  co  m*/
            }
        }
    });
}

From source file:SWTUtils.java

/**
 * Creates an AWT <code>MouseEvent</code> from a swt event.
 * This method helps passing SWT mouse event to awt components.
 * @param event The swt event.//  w  ww.j  av  a 2  s  . c  o  m
 * @return A AWT mouse event based on the given SWT event.
 */
public static MouseEvent toAwtMouseEvent(org.eclipse.swt.events.MouseEvent event) {
    int button = MouseEvent.NOBUTTON;
    switch (event.button) {
    case 1:
        button = MouseEvent.BUTTON1;
        break;
    case 2:
        button = MouseEvent.BUTTON2;
        break;
    case 3:
        button = MouseEvent.BUTTON3;
        break;
    }
    int modifiers = 0;
    if ((event.stateMask & SWT.CTRL) != 0) {
        modifiers |= InputEvent.CTRL_DOWN_MASK;
    }
    if ((event.stateMask & SWT.SHIFT) != 0) {
        modifiers |= InputEvent.SHIFT_DOWN_MASK;
    }
    if ((event.stateMask & SWT.ALT) != 0) {
        modifiers |= InputEvent.ALT_DOWN_MASK;
    }
    MouseEvent awtMouseEvent = new MouseEvent(DUMMY_PANEL, event.hashCode(), event.time, modifiers, event.x,
            event.y, 1, false, button);
    return awtMouseEvent;
}

From source file:com.limegroup.gnutella.gui.tables.ActionIconAndNameEditor.java

public Component getTableCellEditorComponent(final JTable table, Object value, boolean isSelected, int row,
        int column) {
    ActionIconAndNameHolder in = (ActionIconAndNameHolder) value;
    action = in.getAction();/* w ww .  ja  v a  2s  . c  o m*/

    final Component component = new ActionIconAndNameRenderer().getTableCellRendererComponent(table, value,
            isSelected, true, row, column);
    component.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON1) {
                if (actionRegion == null) {
                    component_mousePressed(e);
                } else {
                    if (actionRegion.contains(e.getPoint())) {
                        component_mousePressed(e);
                    } else {
                        if (e.getClickCount() >= 2) {
                            Toolkit.getDefaultToolkit().getSystemEventQueue()
                                    .postEvent(new MouseEvent(table, MouseEvent.MOUSE_CLICKED, e.getWhen(),
                                            e.getModifiers(), component.getX() + e.getX(),
                                            component.getY() + e.getY(), e.getClickCount(), false));
                        }
                    }
                }
            } else if (e.getButton() == MouseEvent.BUTTON3) {
                Toolkit.getDefaultToolkit().getSystemEventQueue()
                        .postEvent(new MouseEvent(table, e.getID(), e.getWhen(), e.getModifiers(),
                                component.getX() + e.getX(), component.getY() + e.getY(), e.getClickCount(),
                                true));
            }
        }
    });

    return component;
}

From source file:org.fhcrc.cpl.viewer.mrm.utilities.MRMerMouseListener.java

public void mouseClicked(MouseEvent e) {
    if (e.getSource() instanceof ChartPanel && ((e.getButton() == MouseEvent.BUTTON2)
            || (e.getButton() == MouseEvent.BUTTON1) && ((e.getModifiers() & InputEvent.CTRL_MASK) != 0))) {
        CenterZoomNumberAxis czna = (CenterZoomNumberAxis) _cp.getChart().getXYPlot().getDomainAxis();
        NumberAxis range = (NumberAxis) _cp.getChart().getXYPlot().getRangeAxis();
        Rectangle2D screenDataArea = _cp.getScreenDataArea(e.getX(), e.getY());
        double y1 = czna.getLowerBound();
        double y2 = czna.getUpperBound();
        double x1 = screenDataArea.getX();
        double x2 = x1 + screenDataArea.getWidth();
        double transformedx = (((y2 - y1) / (x2 - x1)) * (e.getX() - x1)) + y1;
        MRMDialog mrmd = (MRMDialog) MRMAncestor();
        PeaksTableModel model = (PeaksTableModel) mrmd.peaksTable.getModel();
        MRMTransition mrt = mrmd.transitionOnPlot;
        mrt.setCalcXatMaxYAllDaughters(transformedx);
        mrt.setCalcMaxYAllDaughters(//from w  w w  .  ja  v a2  s.  c o  m
                range.getLowerBound() + 0.95 * (range.getUpperBound() - range.getLowerBound()));
        model.setValueAt(new Float(mrt.getCalcXatMaxYAllDaughters()), mrt.getTableRow(),
                MRMDialog.peaksData.MidTime.colno);
        for (MRMDaughter d : mrt.getDaughters().values()) {
            model.setValueAt(new Float(mrt.getCalcXatMaxYAllDaughters()), d.getElutionDataTableRow(),
                    MRMDialog.peaksData.MidTime.colno);
        }
        mrmd.updateChartsAndFields(false);
    }
    if ((e.isShiftDown() || e.getButton() == MouseEvent.BUTTON3) || shifted) {
        _cp.mouseClicked(e);
    } else {
        _cp.mouseClicked(e);
    }
}

From source file:org.optaplanner.examples.tsp.swingui.TspWorldPanel.java

public TspWorldPanel(TspPanel tspPanel) {
    this.tspPanel = tspPanel;
    addComponentListener(new ComponentAdapter() {
        @Override//from w w  w .  ja  v a 2  s .c  o m
        public void componentResized(ComponentEvent e) {
            // TODO Not thread-safe during solving
            TravelingSalesmanTour travelingSalesmanTour = TspWorldPanel.this.tspPanel
                    .getTravelingSalesmanTour();
            if (travelingSalesmanTour != null) {
                resetPanel(travelingSalesmanTour);
            }
        }
    });
    MouseAdapter mouseAdapter = new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            if (translator != null) {
                double longitude = translator.translateXToLongitude(e.getX());
                double latitude = translator.translateYToLatitude(e.getY());
                if (e.getButton() == MouseEvent.BUTTON1) {
                    dragSourceStandstill = TspWorldPanel.this.tspPanel
                            .findNearestStandstill(new AirLocation(-1L, latitude, longitude));
                    TravelingSalesmanTour tour = TspWorldPanel.this.tspPanel.getTravelingSalesmanTour();
                    dragTargetStandstill = tour.getDomicile();
                    resetPanel(tour);
                } else if (e.getButton() == MouseEvent.BUTTON2 || e.getButton() == MouseEvent.BUTTON3) {
                    TspWorldPanel.this.tspPanel.insertLocationAndVisit(longitude, latitude);
                }
            }
        }

        @Override
        public void mouseDragged(MouseEvent e) {
            if (translator != null) {
                if (dragSourceStandstill != null) {
                    double longitude = translator.translateXToLongitude(e.getX());
                    double latitude = translator.translateYToLatitude(e.getY());
                    dragTargetStandstill = TspWorldPanel.this.tspPanel
                            .findNearestStandstill(new AirLocation(-1L, latitude, longitude));
                    TravelingSalesmanTour tour = TspWorldPanel.this.tspPanel.getTravelingSalesmanTour();
                    if (dragSourceStandstill == dragTargetStandstill) {
                        dragTargetStandstill = tour.getDomicile();
                    }
                    resetPanel(tour);
                }
            }
        }

        @Override
        public void mouseReleased(MouseEvent e) {
            if (translator != null) {
                if (e.getButton() == MouseEvent.BUTTON1) {
                    double longitude = translator.translateXToLongitude(e.getX());
                    double latitude = translator.translateYToLatitude(e.getY());
                    dragTargetStandstill = TspWorldPanel.this.tspPanel
                            .findNearestStandstill(new AirLocation(-1L, latitude, longitude));
                    TravelingSalesmanTour tour = TspWorldPanel.this.tspPanel.getTravelingSalesmanTour();
                    if (dragSourceStandstill == dragTargetStandstill) {
                        dragTargetStandstill = tour.getDomicile();
                    }
                    Standstill sourceStandstill = TspWorldPanel.this.dragSourceStandstill;
                    Standstill targetStandstill = TspWorldPanel.this.dragTargetStandstill;
                    TspWorldPanel.this.dragSourceStandstill = null;
                    TspWorldPanel.this.dragTargetStandstill = null;
                    // connectStandstills() will call resetPanel()
                    TspWorldPanel.this.tspPanel.connectStandstills(sourceStandstill, targetStandstill);
                }
            }
        }
    };
    addMouseListener(mouseAdapter);
    addMouseMotionListener(mouseAdapter);
    europaBackground = new ImageIcon(getClass().getResource("europaBackground.png"));
}