List of usage examples for java.awt.event MouseEvent getClickCount
public int getClickCount()
From source file:com.jcraft.weirdx.DDXWindowImp.java
@SuppressWarnings("unused") public void mouseDragged(MouseEvent e) { if (threeButton) { if (threeBstate != s) { if (threeBstate == sp) { procPressed(threeBPressed); threeBPressed = null;/*from ww w . j a va 2 s. co m*/ threeBstate = s; } else if (threeBstate == spp) { e = new MouseEvent((Component) e.getSource(), e.getID(), e.getWhen(), (e.getModifiers() & (~(InputEvent.BUTTON1_MASK | InputEvent.BUTTON3_MASK))) | InputEvent.BUTTON2_MASK, e.getX(), e.getY(), e.getClickCount(), e.isPopupTrigger()); } else if (threeBstate == sppr) { return; } } } if (window == null) return; // calc abs cursor position use old window position for calculation // as mouseDragged (if you use Panel) delivers its coordinates relative to the position after mousepressed // UPDATE: this was a bug of the IBM JDK // int x=e.getX()+oldwindowx; // int y=e.getY()+oldwindowy; int x = e.getX() + window.x; int y = e.getY() + window.y; // set new drag position (absolute) XWindow.sprite.hot.x = x; XWindow.sprite.hot.y = y; int mod = e.getModifiers(); // button 1 -> 16 // button 2 -> 8 // button 3 -> 4 // shift -> 1 // control -> 2 // alt -> 12 ?? int state = 0; int detail = 0; if ((mod & InputEvent.BUTTON1_MASK) != 0) { state |= (1 << 8); detail = 1; } if ((mod & InputEvent.BUTTON2_MASK) != 0) { state |= (1 << 9); detail = 2; } if ((mod & InputEvent.BUTTON3_MASK) != 0) { state |= (1 << 10); detail = 3; } if ((mod & InputEvent.SHIFT_MASK) != 0) state |= 1; if ((mod & InputEvent.CTRL_MASK) != 0) state |= 4; // alt -> state|=8; XWindow.sprite.hot.state = state; px = x; py = y; event.mkMotionNotify(1, window.screen.rootId, XWindow.sprite.win.id, 0, px, py, e.getX(), e.getY(), state, 1); try { if (!XWindow.checkMotion(event, window)) { return; } event.mkMotionNotify(1, window.screen.rootId, XWindow.sprite.win.id, 0, px, py, px - XWindow.sprite.win.x, py - XWindow.sprite.win.y, state, 1); if (XWindow.grab != null) { XWindow.sendGrabbedEvent(event, false, 1); } else { XWindow.sendDeviceEvent(XWindow.sprite.win, event, XWindow.grab, null, 1); } } catch (Exception ee) { } }
From source file:de.mendelson.comm.as2.client.AS2Gui.java
private void jTableMessageOverviewMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableMessageOverviewMouseClicked //double click on a row if (evt.getClickCount() == 2) { this.showSelectedRowDetails(); }/*from w w w . jav a 2 s. co m*/ }
From source file:base.BasePlayer.ClusterTable.java
public void mouseClicked(MouseEvent event) { switch (event.getModifiers()) { case InputEvent.BUTTON1_MASK: { if (!this.isEnabled()) { break; }//from w w w . j a v a 2 s .c o m if (this.headerHover == -1) { if (event.getClickCount() == 2) { FileRead.novars = true; if (hoverSample > -1) { Main.drawCanvas.drawVariables.visiblestart = (short) (hoverSample); Main.drawCanvas.drawVariables.visiblesamples = (short) (1); Main.drawCanvas.resizeCanvas(Main.drawScroll.getViewport().getWidth(), (int) (Main.samples * Main.drawCanvas.drawVariables.sampleHeight)); Draw.setScrollbar((int) (hoverSample * Main.drawCanvas.drawVariables.sampleHeight)); } FileRead.search = true; if (hoverVar != null) { VarNode searchHead = hoverVar; while (searchHead.getPrev() != null) { if (searchHead.getPrev().getPosition() == 0) { searchHead.getPrev().putNext(searchHead); } searchHead = searchHead.getPrev(); } FileRead.head = searchHead; searchHead = null; Main.drawCanvas.current = hoverVar; if (hoverVar.getExons() != null) { Main.drawCanvas.gotoPos(hoverVar.getExons().get(0).getTranscript().getChrom(), hoverVar.getPosition() + 1 - 50, hoverVar.getPosition() + 1 + 50); } else { if (hoverVar.getTranscripts() != null) { Main.drawCanvas.gotoPos(hoverVar.getTranscripts().get(0).getChrom(), hoverVar.getPosition() + 1 - 50, hoverVar.getPosition() + 1 + 50); } } } else if (hoverNode != null) { VarNode searchHead = hoverNode.varnodes.get(0); if (hoverNode.varnodes.get(0).getTranscripts() != null) { if (!chrom.equals(hoverNode.varnodes.get(0).getTranscripts().get(0).getChrom())) { chrom = hoverNode.varnodes.get(0).getTranscripts().get(0).getChrom(); } } else { if (!chrom.equals(hoverNode.varnodes.get(0).getExons().get(0).transcript.getChrom())) { chrom = hoverNode.varnodes.get(0).getExons().get(0).transcript.getChrom(); } } while (searchHead.getPrev() != null) { if (searchHead.getPrev().getPosition() == 0) { searchHead.getPrev().putNext(searchHead); } searchHead = searchHead.getPrev(); } FileRead.head = searchHead; searchHead = null; Main.drawCanvas.current = hoverNode.varnodes.get(0); Main.drawCanvas.gotoPos(chrom, hoverNode.varnodes.get(0).getPosition(), hoverNode.varnodes.get(0).getPosition() + hoverNode.width); } break; } else if (event.getClickCount() == 1) { if (hoverVar != null && (selectedVar == null || !selectedVar.equals(hoverVar))) { selectedVar = hoverVar; selectedString = hoverString; if (selectedVar.isRscode() != null) { hoverString[4] = selectedVar.rscode; } repaint(); this.setPreferredSize(new Dimension(this.getWidth(), (this.getTableSize() + 2 + samplecount + Integer.parseInt(selectedString[1])) * rowHeight)); this.revalidate(); } else if (hoverVar != null && selectedVar.equals(hoverVar)) { if (hoverSample == -1) { selectedVar = null; repaint(); this.setPreferredSize(new Dimension(this.getWidth(), (this.getTableSize() + 2 + samplecount) * rowHeight)); this.revalidate(); } } else { if (hoverVar != null && selectedNode != null && hoverNode.equals(selectedNode)) { selectedString = hoverString; samplecount = 0; repaint(); } else { if (hoverSample == -1) { if (hoverNode != null) { if (selectedNode != null && selectedNode.equals(hoverNode)) { selectedString = null; selectedNode = null; hoverVar = null; selectedVar = null; aminoarray.clear(); this.setPreferredSize(new Dimension(this.getWidth(), (this.getTableSize() + 2) * rowHeight + 10)); this.revalidate(); repaint(); break; } selectedNode = hoverNode; selectedString = hoverString; // samplecount = selectedNode.mutations; samplecount = selectedNode.varnodes.size(); this.setPreferredSize(new Dimension(this.getWidth(), (this.getTableSize() + 2 + samplecount) * rowHeight + 10)); this.revalidate(); getAminos(selectedNode); repaint(); } } } } } } break; } case InputEvent.BUTTON3_MASK: { selectedNode = null; selectedVar = null; repaint(); } } }
From source file:ro.nextreports.designer.querybuilder.DBBrowserTree.java
private void selectionProcedure(DBBrowserNode selectedNode, MouseEvent e) { ViewProcedureColumnsInfoAction infoAction = new ViewProcedureColumnsInfoAction(selectedNode.getDBObject()); if (e.getClickCount() == 2) { infoAction.actionPerformed(null); } else {// w w w . j a v a 2 s .c o m JPopupMenu popupMenu = new JPopupMenu(); JMenuItem menuItem = new JMenuItem(infoAction); popupMenu.add(menuItem); JMenuItem menuItem2 = new JMenuItem(new ValidateProceduresAction(selectedNode.getDBObject())); popupMenu.add(menuItem2); popupMenu.show((Component) e.getSource(), e.getX(), e.getY()); } }
From source file:com.jcraft.weirdx.DDXWindowImpSwing.java
public void mouseReleased(MouseEvent e) { if (threeButton) { if (threeBstate == sppr) { threeBPressed = null;// w w w . j a v a2s. com threeBstate = s; return; } if (threeBstate == sp) { procPressed(threeBPressed); threeBPressed = null; threeBstate = s; } else if (threeBstate == spp) { threeBPressed = null; threeBstate = sppr; e = new MouseEvent((Component) e.getSource(), e.getID(), e.getWhen(), (e.getModifiers() & (~(InputEvent.BUTTON1_MASK | InputEvent.BUTTON3_MASK))) | InputEvent.BUTTON2_MASK, e.getX(), e.getY(), e.getClickCount(), e.isPopupTrigger()); } } procReleased(e); }
From source file:com.jcraft.weirdx.DDXWindowImp.java
public void mouseReleased(MouseEvent e) { if (threeButton) { if (threeBstate == sppr) { threeBPressed = null;//from w w w .j ava 2s . co m threeBstate = s; return; } if (threeBstate == sp) { procPressed(threeBPressed); threeBPressed = null; threeBstate = s; } else if (threeBstate == spp) { threeBPressed = null; threeBstate = sppr; e = new MouseEvent((Component) e.getSource(), e.getID(), e.getWhen(), (e.getModifiers() & (~(InputEvent.BUTTON1_MASK | InputEvent.BUTTON3_MASK))) | InputEvent.BUTTON2_MASK, e.getX(), e.getY(), e.getClickCount(), e.isPopupTrigger()); } } try { procReleased(e); } catch (Exception ee) { } }
From source file:org.photovault.swingui.PhotoCollectionThumbView.java
/** * On mouse click select the photo clicked. * * @param mouseEvent a <code>MouseEvent</code> value */// w w w .j a va2 s . co m public void mouseClicked(MouseEvent mouseEvent) { log.debug("mouseClicked (" + mouseEvent.getX() + ", " + mouseEvent.getY()); if (dragJustEnded) { // Selection was already handled by drag handler so do nothing dragJustEnded = false; return; } PhotoInfo clickedPhoto = getPhotoAtLocation(mouseEvent.getX(), mouseEvent.getY()); if (clickedPhoto != null) { if (mouseEvent.isControlDown()) { photoClickedCtrlDown(clickedPhoto); } else { photoClickedNoModifiers(clickedPhoto); } // If this was a doublke click open the selected photo(s) if (mouseEvent.getClickCount() == 2) { showSelectedPhotoAction.actionPerformed(new ActionEvent(this, 0, null)); } } else { // The click was between photos. Clear the selection if (!mouseEvent.isControlDown()) { Object[] oldSelection = selection.toArray(); selection.clear(); fireSelectionChangeEvent(); for (int n = 0; n < oldSelection.length; n++) { PhotoInfo photo = (PhotoInfo) oldSelection[n]; repaintPhoto(photo); } } } repaintPhoto(clickedPhoto); }
From source file:com.u2apple.tool.ui.MainFrame.java
private void initRowSelectionEvent() { deviceTable.getSelectionModel().addListSelectionListener((ListSelectionEvent e) -> { int row = deviceTable.getSelectedRow(); //When refresh table model data, row will be -1. if (row >= 0) { String vid = (String) deviceTable.getValueAt(row, 0); String model = (String) deviceTable.getValueAt(row, 1); String brand = (String) deviceTable.getValueAt(row, 2); vidTextField.setText(vid);//from www .j av a2 s. c o m modelTextField.setText(model); brandTextField.setText(brand); } //Auto fullfil device information. initDevice(); }); deviceTable.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent me) { JTable table = (JTable) me.getSource(); Point p = me.getPoint(); int row = table.rowAtPoint(p); if (me.getClickCount() == 2) { String vid = (String) deviceTable.getValueAt(row, 0); String model = (String) deviceTable.getValueAt(row, 1); String brand = (String) deviceTable.getValueAt(row, 2); AndroidDeviceRanking androidDevice = new AndroidDeviceRanking(); androidDevice.setVid(vid); androidDevice.setRoProductModel(model); androidDevice.setRoProductBrand(brand); androidDevice.setCheckDate(new Date()); try { DeviceCache.markDeviceChecked(androidDevice); } catch (JAXBException ex) { Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex); } DeviceTableModel tableModel = (DeviceTableModel) deviceTable.getModel(); tableModel.removeRow(row); } } }); }
From source file:net.sf.jabref.gui.groups.GroupSelector.java
private void definePopup() { // These key bindings are just to have the shortcuts displayed // in the popup menu. The actual keystroke processing is in // BasePanel (entryTable.addKeyListener(...)). groupsContextMenu.add(editGroupPopupAction); groupsContextMenu.add(addGroupPopupAction); groupsContextMenu.add(addSubgroupPopupAction); groupsContextMenu.addSeparator();/*from w ww .j a v a 2 s . co m*/ groupsContextMenu.add(removeGroupAndSubgroupsPopupAction); groupsContextMenu.add(removeGroupKeepSubgroupsPopupAction); groupsContextMenu.add(removeSubgroupsPopupAction); groupsContextMenu.addSeparator(); groupsContextMenu.add(expandSubtreePopupAction); groupsContextMenu.add(collapseSubtreePopupAction); groupsContextMenu.addSeparator(); groupsContextMenu.add(moveSubmenu); sortSubmenu.add(sortDirectSubgroupsPopupAction); sortSubmenu.add(sortAllSubgroupsPopupAction); groupsContextMenu.add(sortSubmenu); moveSubmenu.add(moveNodeUpPopupAction); moveSubmenu.add(moveNodeDownPopupAction); moveSubmenu.add(moveNodeLeftPopupAction); moveSubmenu.add(moveNodeRightPopupAction); groupsContextMenu.addSeparator(); groupsContextMenu.add(addToGroup); groupsContextMenu.add(moveToGroup); groupsContextMenu.add(removeFromGroup); groupsTree.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (e.isPopupTrigger()) { showPopup(e); } } @Override public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger()) { showPopup(e); } } @Override public void mouseClicked(MouseEvent e) { TreePath path = groupsTree.getPathForLocation(e.getPoint().x, e.getPoint().y); if (path == null) { return; } GroupTreeNodeViewModel node = (GroupTreeNodeViewModel) path.getLastPathComponent(); // the root node is "AllEntries" and cannot be edited if (node.getNode().isRoot()) { return; } if ((e.getClickCount() == 2) && (e.getButton() == MouseEvent.BUTTON1)) { // edit editGroupAction.actionPerformed(null); // dummy event } else if ((e.getClickCount() == 1) && (e.getButton() == MouseEvent.BUTTON1)) { annotationEvent(node); } } }); // be sure to remove a possible border highlight when the popup menu // disappears groupsContextMenu.addPopupMenuListener(new PopupMenuListener() { @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { // nothing to do } @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { groupsTree.setHighlightBorderCell(null); } @Override public void popupMenuCanceled(PopupMenuEvent e) { groupsTree.setHighlightBorderCell(null); } }); }
From source file:net.ytbolg.mcxa.MCLaucherXA.java
private void jList1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList1MouseClicked if (jList1.getSelectedIndex() == -1) { return;/*from www.jav a2 s.co m*/ } try { if (MakeCmd.isChanged( new ZipFile(GameInfo.GameDir + tpf + "versions" + tpf + jList1.getSelectedValue().toString() + tpf + jList1.getSelectedValue().toString() + ".jar"))) { jComboBox1.setSelectedItem( "-Dfml.ignoreInvalidMinecraftCertificates=true -Dfml.ignorePatchDiscrepancies=true"); } else { jComboBox1.setSelectedItem(""); } } catch (IOException ex) { Logger.getLogger(MCLaucherXA.class.getName()).log(Level.SEVERE, null, ex); } if (evt.getButton() == MouseEvent.BUTTON3 && jList1.getSelectedIndex() != -1) { jPopupMenu1.show(this, evt.getX() + 25, evt.getY() + 25); } if (evt.getButton() == MouseEvent.BUTTON2 && evt.getClickCount() == 2) { jButton1ActionPerformed(null); } try { BrushLabels(jList1.getSelectedIndex()); } catch (JSONException e) { } catch (Exception ex) { Logger.getLogger(MCLaucherXA.class.getName()).log(Level.SEVERE, null, ex); } // TODO add your handling code here: }