List of usage examples for java.awt.event MouseEvent getButton
public int getButton()
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 www .ja 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, 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. *//*w w w. j a v a 2s. c om*/ 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.ImportTab.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 av 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, importTable); } } }); }
From source file:com.db2eshop.gui.component.tab.SaleTab.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 ww . j a v a2 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, saleTable); } } }); }
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. *//*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, shippingTable); } } }); }
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 w w.java 2 s .c om*/ 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.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();//from ww w . 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:de.tbuchloh.kiskis.gui.systray.Java6SystemTray.java
/** * @see de.tbuchloh.kiskis.gui.systray.ISystemTray#show() *///from ww w. ja v a 2 s.co m public void show() { if (!SystemTray.isSupported()) { LOG.error("System tray is not supported!"); return; } final SystemTray tray = SystemTray.getSystemTray(); final Image image = Toolkit.getDefaultToolkit().getImage(_main.getTrayIconURL()); final MouseListener mouseListener = new MouseAdapter() { @Override public void mouseClicked(final MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() >= 2) { _main.setVisible(!_main.isVisible()); } } }; final PopupMenu popup = _main.getPopupMenu(); _trayIcon = new TrayIcon(image, BuildProperties.getFullTitle(), popup); _trayIcon.setImageAutoSize(true); _trayIcon.addMouseListener(mouseListener); try { tray.add(_trayIcon); } catch (final AWTException e) { e.printStackTrace(); } }
From source file:de.tbuchloh.kiskis.gui.widgets.BasicTextField.java
private void init() { _copyAction = M.createAction(this, "onCopyToClipboard"); _specialActionsMenu = new JPopupMenu(); for (final Object element : getContextMenuActions()) { final Action act = (Action) element; _specialActionsMenu.add(act);/* w w w . ja v a 2 s .c om*/ } addMouseListener(new MouseAdapter() { @Override public void mousePressed(final MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { return; } final int x = 0; // _pwdField.getWidth() // - _specialActionsMenu.getWidth(); final int y = getHeight(); LOG.debug("Show context menu x=" + x + ", y=" + y); _specialActionsMenu.show(BasicTextField.this, x, y); } }); }
From source file:org.jcurl.demo.editor.SpeedController.java
public void mouseClicked(MouseEvent e) { log.info("" + hot.idx); if (e.getButton() == MouseEvent.BUTTON1) { int mask = 1 << hot.idx; if (e.isShiftDown()) { int old = panel.getSelectedMask(); if ((mask & old) == 0) mask |= old;//from w w w.jav a2 s . co m else mask = ~mask & old; } panel.setSelectedMask(mask); } }