List of usage examples for java.awt.event MouseEvent BUTTON1
int BUTTON1
To view the source code for java.awt.event MouseEvent BUTTON1.
Click Source Link
From source file:de.tor.tribes.ui.components.GroupSelectionList.java
public GroupSelectionList(String pResourceURL) { super(pResourceURL); setCellRenderer(renderer);/* ww w .ja v a2 s . com*/ addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_LEFT) { fireDecrementEvent(); } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { fireIncrementEvent(); } else if (e.getKeyCode() == KeyEvent.VK_DELETE) { fireResetEvent(); } else if (e.getKeyCode() == KeyEvent.VK_O) { fireSetStateEvent(ListItem.RELATION_TYPE.OR); } else if (e.getKeyCode() == KeyEvent.VK_U) { fireSetStateEvent(ListItem.RELATION_TYPE.AND); } else if (e.getKeyCode() == KeyEvent.VK_N) { fireSetStateEvent(ListItem.RELATION_TYPE.NOT); } else if (e.getKeyCode() == KeyEvent.VK_I) { fireSetStateEvent(ListItem.RELATION_TYPE.DISABLED); } else if (e.getKeyCode() == KeyEvent.VK_H) { JOptionPaneHelper.showInformationBox(GroupSelectionList.this, getRelationAsPlainText(), "Information"); } } }); addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { if (e.getButton() == MouseEvent.BUTTON1) { fireClickedEvent(e.getPoint()); } else { fireResetEvent(e.getPoint()); } } } }); TagManager.getSingleton().addManagerListener(GroupSelectionList.this); }
From source file:se.trixon.jota.client.ui.editor.module.DualListPanel.java
private void initListeners() { availableListPanel.getList().addMouseListener(new MouseAdapter() { @Override/*from w ww . j a va2s . co m*/ public void mouseClicked(MouseEvent evt) { if (evt.getButton() == MouseEvent.BUTTON1 && evt.getClickCount() == 2) { activate(); } } }); selectedListPanel.getList().addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent evt) { if (evt.getButton() == MouseEvent.BUTTON1 && evt.getClickCount() == 2) { deactivate(); } } }); }
From source file:org.interreg.docexplore.management.manage.ManageComponent.java
@SuppressWarnings("serial") public ManageComponent(MainWindow win, final ManageHandler handler, boolean editable, boolean showPages) { super(new BorderLayout()); this.win = win; this.handler = handler; this.bookList = new JList(new CollectionNode(this)); setBorder(BorderFactory.createLineBorder(Color.black, 1)); bookList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); bookList.setCellRenderer(new ManageCellRenderer()); //tree.setRowHeight(52); add(new JScrollPane(bookList), BorderLayout.CENTER); if (editable) { bookList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) { int index = bookList.locationToIndex(e.getPoint()); if (index < 0 || !bookList.getCellBounds(index, index).contains(e.getPoint())) return; handler.bookOpened((Book) bookList.getModel().getElementAt(index)); }//from w w w . jav a2 s .c om } }); this.toolbar = new ManageToolbar(this); add(toolbar, BorderLayout.NORTH); bookList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) return; int count = bookList.getSelectedIndices().length; toolbar.deleteButton.setEnabled(count > 0); toolbar.editButton.setEnabled(count == 1); // toolbar.processButton.setEnabled(count == 1); toolbar.exportButton.setEnabled(count == 1); } }); } bookList.setBackground(new JPanel().getBackground()); getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) .put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "DEL"); getActionMap().put("DEL", new AbstractAction() { public void actionPerformed(ActionEvent arg0) { @SuppressWarnings({ "unchecked", "rawtypes" }) Vector<Book> books = new Vector(Arrays.asList(bookList.getSelectedValues())); if (books.size() > 0 && handler.booksDeleted(books)) { ((CollectionNode) bookList.getModel()).reload(); bookList.clearSelection(); bookList.repaint(); } } }); }
From source file:ru.codemine.pos.ui.windows.devices.barcodescanner.BarcodeScannerListWindow.java
@Override public void setupActionListeners() { setNewActionListener(newBarcodeScannerDevice); setEditActionListener(editBarcodeScannerDevice); setDeleteActionListener(deleteBarcodeScannerDevice); setProcessActionListener(setActiveBarcodeScannerDevice); setRefreshActionListener(refreshBarcodeScannerDeviceList); table.addMouseListener(new MouseAdapter() { @Override// w w w. jav a 2 s.c o m public void mousePressed(MouseEvent e) { Point p = e.getPoint(); int row = table.rowAtPoint(p); if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) { menuItemEdit.doClick(); } } }); actionListenersInit = true; }
From source file:org.eclipse.birt.chart.device.swing.SwingEventHandler.java
private final boolean isLeftButton(MouseEvent e) { return (e.getButton() == MouseEvent.BUTTON1); }
From source file:ru.codemine.pos.ui.windows.products.ProductsListWindow.java
@Override public void setupActionListeners() { setNewActionListener(newProduct);//from www. j a va 2s. c o m setEditActionListener(editProduct); setDeleteActionListener(deleteProduct); setRefreshActionListener(refreshProductList); toolButtonPrintStickers.addActionListener(printProductStickers); menuItemPrintStickers.addActionListener(printProductStickers); table.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { Point p = e.getPoint(); int row = table.rowAtPoint(p); if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) { menuItemEdit.doClick(); } } }); actionListenersInit = true; }
From source file:ru.codemine.pos.ui.windows.devices.kkm.KkmListWindow.java
@Override public void setupActionListeners() { setNewActionListener(newKkmDevice);/*www . jav a 2 s .c o m*/ setEditActionListener(editKkmDevice); setDeleteActionListener(deleteKkm); setProcessActionListener(setActiveKkm); setRefreshActionListener(refreshKkmDeviceList); toolButtonTestCheque.addActionListener(testKkmDevice); table.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { Point p = e.getPoint(); int row = table.rowAtPoint(p); if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) { menuItemEdit.doClick(); } } }); actionListenersInit = true; }
From source file:org.openmicroscopy.shoola.agents.util.ui.ChannelButton.java
/** * Selects the channel or displays the pop up menu. * * @param e The mouse event to handle./*from w w w .j a va 2s .c o m*/ */ private void onClick(MouseEvent e) { boolean mask = (e.isControlDown() || e.isMetaDown()); if (e.getButton() == MouseEvent.BUTTON1 && !(mask)) setChannelSelected(); else if ((e.getButton() == MouseEvent.BUTTON2 || mask)) onReleased(e); }
From source file:ru.codemine.pos.ui.windows.document.startbalances.StartBalancesListWindow.java
@Override public void setupActionListeners() { setNewActionListener(newSb);//from w ww.j av a 2 s . c o m setEditActionListener(editSb); setDeleteActionListener(deleteSb); setProcessActionListener(processSb); setUnprocessActionListener(unprocessSb); setRefreshActionListener(refreshSbList); storeChooseBox.addActionListener(changeStoreSb); table.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { Point p = e.getPoint(); int row = table.rowAtPoint(p); if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) { menuItemEdit.doClick(); } } }); actionListenersInit = true; }
From source file:org.kalypso.kalypsomodel1d2d.ui.map.channeledit.DrawBanklineWidget.java
@Override public void mousePressed(final MouseEvent event) { if (event.getButton() != MouseEvent.BUTTON1) return;/*from w ww .jav a 2 s. c om*/ event.consume(); final IMapPanel mapPanel = getMapPanel(); if (mapPanel == null) return; final Point p = event.getPoint(); m_currentPos = MapUtilities.transform(mapPanel, p); /* If we have a node, take this position, else take the current one */ // final GM_Point currentPos = MapUtilities.transform( mapPanel, p ); if (!m_edit) { try { final GM_Curve curve = (GM_Curve) m_lineBuilder.addPoint(m_currentPos); if (curve != null) finishLine(curve); } catch (final Exception e) { e.printStackTrace(); reinit(); } } }