List of usage examples for java.awt.event MouseEvent getClickCount
public int getClickCount()
From source file:ru.apertum.qsystem.client.forms.FReception.java
private void tableServicesMonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tableServicesMonMouseClicked if (evt.getClickCount() > 1 && tableServicesMon.getSelectedRow() != -1) { tabsPane.setSelectedComponent(panelServices); TreeNode[] nodes = ((DefaultTreeModel) treeServices.getModel()) .getPathToRoot(((ATreeModel) treeServices.getModel()).getById(((ServiceInfo) tableServicesMon .getModel().getValueAt(tableServicesMon.getSelectedRow(), 2)).getId())); TreePath path = new TreePath(nodes); treeServices.setSelectionPath(path); treeServices.setExpandsSelectedPaths(true); treeServices.scrollPathToVisible(path); }/*from ww w . j a v a2 s .co m*/ }
From source file:ru.apertum.qsystem.client.forms.FReception.java
private void listServicesForUserMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listServicesForUserMouseClicked if (evt.getClickCount() > 1 && listServicesForUser.getSelectedIndex() != -1) { tabsPane.setSelectedComponent(panelServices); TreeNode[] nodes = ((DefaultTreeModel) treeServices.getModel()) .getPathToRoot(((ATreeModel) treeServices.getModel()) .getById(((QPlanService) listServicesForUser.getSelectedValue()).getService().getId())); TreePath path = new TreePath(nodes); treeServices.setSelectionPath(path); treeServices.setExpandsSelectedPaths(true); treeServices.scrollPathToVisible(path); }/*from w ww. j av a2s . c o m*/ }
From source file:com.biosis.biosislite.vistas.dialogos.DlgEmpleadoCRUD.java
private void tblAreasMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblAreasMouseReleased // TODO add your handling code here: if (evt.getClickCount() == 1) { int fila = tblAreas.getSelectedRow(); this.areaEmpMOD = lista.get(fila); txtArea.setText(areaEmpMOD.getDepartamento().getNombre()); dtFechaInicio.setDate(areaEmpMOD.getFechaInicio()); dtFechaFin.setDate(areaEmpMOD.getFechaFin()); }/*from www. j a v a2 s .co m*/ }
From source file:com.biosis.biosislite.vistas.dialogos.DlgEmpleadoCRUD.java
private void tblContratosMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblContratosMouseReleased // TODO add your handling code here: if (evt.getClickCount() == 1) { int fila = tblContratos.getSelectedRow(); this.contratoMOD = lista2.get(fila); cboRegimenLaboral.setSelectedItem(contratoMOD.getRegimenLaboral()); cboTipoContrato.setSelectedItem(contratoMOD.getTipoContrato()); dcFechaInicio.setDate(contratoMOD.getFechaInicio()); dcFechaFin.setDate(contratoMOD.getFechaFin()); }/*from w w w .ja va2 s .co m*/ }
From source file:net.sf.jabref.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();// w w w .j ava2 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; } GroupTreeNode node = (GroupTreeNode) path.getLastPathComponent(); // the root node is "AllEntries" and cannot be edited if (node.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:org.martin.ftp.gui.GUIClient.java
private void tblFilesMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblFilesMouseReleased if (evt.getButton() == 3) { }/*from w w w . ja v a 2 s.c o m*/ if (evt.getClickCount() == 2) try { setWorkingDirectory(); } catch (IOException ex) { Logger.getLogger(GUIClient.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:corelyzer.ui.CorelyzerApp.java
public void mouseClicked(final MouseEvent e) { if (e.getClickCount() == 2) { // double clicks Object actionSource = e.getSource(); if (actionSource.equals(sectionList)) { int selectedTrackIdx = trackList.getSelectedIndex(); int selectedSectionIdx = sectionList.getSelectedIndex(); if ((selectedTrackIdx < 0) || (selectedSectionIdx < 0)) { // System.out.println("" + selectedTrackIdx + ", " // + selectedSectionIdx); return; }// w w w . j a v a2s. c o m CRDefaultListModel trackListModel = getTrackListModel(); CRDefaultListModel sectionsListModel = getSectionListModel(); if ((trackListModel.getSize() == 0) || (sectionsListModel.getSize() == 0)) { System.out.println("0 list models"); return; } TrackSceneNode t = (TrackSceneNode) trackListModel.getElementAt(selectedTrackIdx); String secname = ((CoreSection) sectionsListModel.getElementAt(selectedSectionIdx)).getName(); if (t == null) { System.out.println("- Null track list selection"); return; } CoreSection cs = t.getCoreSection(secname); if (cs == null) { System.out.println("- Null CoreSection list section"); return; } CRExperimentController.locateSection(t.getId(), cs.getId()); } else if (actionSource.equals(trackList)) { // if it's track, move to track's Y-pos TrackSceneNode t = (TrackSceneNode) trackList.getSelectedValue(); if (t != null) { int nativeTrackId = t.getId(); if (nativeTrackId < 0) { return; } float posX; float posY; SceneGraph.lock(); { if (SceneGraph.getDepthOrientation()) { posX = SceneGraph.getSceneCenterX(); posY = SceneGraph.getTrackYPos(nativeTrackId); } else { posX = -SceneGraph.getTrackYPos(nativeTrackId); posY = SceneGraph.getSceneCenterY(); } SceneGraph.positionScene(posX, posY); } SceneGraph.unlock(); updateGLWindows(); } } } }
From source file:com.t3.client.ui.T3Frame.java
private JComponent createTokenTreePanel() { final JTree tree = new JTree(); tokenPanelTreeModel = new TokenPanelTreeModel(tree); tree.setModel(tokenPanelTreeModel);/* www . j a v a 2 s .c o m*/ tree.setCellRenderer(new TokenPanelTreeCellRenderer()); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); tree.addMouseListener(new MouseAdapter() { // TODO: Make this a handler class, not an aic @Override public void mousePressed(MouseEvent e) { // tree.setSelectionPath(tree.getPathForLocation(e.getX(), e.getY())); TreePath path = tree.getPathForLocation(e.getX(), e.getY()); if (path == null) { return; } Object row = path.getLastPathComponent(); int rowIndex = tree.getRowForLocation(e.getX(), e.getY()); if (SwingUtilities.isLeftMouseButton(e)) { if (!SwingUtil.isShiftDown(e)) { tree.clearSelection(); } tree.addSelectionInterval(rowIndex, rowIndex); if (row instanceof Token) { if (e.getClickCount() == 2) { Token token = (Token) row; getCurrentZoneRenderer().clearSelectedTokens(); getCurrentZoneRenderer().centerOn(new ZonePoint(token.getX(), token.getY())); // Pick an appropriate tool getToolbox().setSelectedTool(token.isToken() ? PointerTool.class : StampTool.class); getCurrentZoneRenderer().setActiveLayer(token.getLayer()); getCurrentZoneRenderer().selectToken(token.getId()); getCurrentZoneRenderer().requestFocusInWindow(); } } } if (SwingUtilities.isRightMouseButton(e)) { if (!isRowSelected(tree.getSelectionRows(), rowIndex) && !SwingUtil.isShiftDown(e)) { tree.clearSelection(); tree.addSelectionInterval(rowIndex, rowIndex); } final int x = e.getX(); final int y = e.getY(); EventQueue.invokeLater(new Runnable() { @Override public void run() { Token firstToken = null; Set<GUID> selectedTokenSet = new HashSet<GUID>(); for (TreePath path : tree.getSelectionPaths()) { if (path.getLastPathComponent() instanceof Token) { Token token = (Token) path.getLastPathComponent(); if (firstToken == null) { firstToken = token; } if (AppUtil.playerOwns(token)) { selectedTokenSet.add(token.getId()); } } } if (!selectedTokenSet.isEmpty()) { try { if (firstToken.isStamp()) { new StampPopupMenu(selectedTokenSet, x, y, getCurrentZoneRenderer(), firstToken).showPopup(tree); } else { new TokenPopupMenu(selectedTokenSet, x, y, getCurrentZoneRenderer(), firstToken).showPopup(tree); } } catch (IllegalComponentStateException icse) { log.info(tree.toString(), icse); } } } }); } } }); TabletopTool.getEventDispatcher().addListener(new AppEventListener() { @Override public void handleAppEvent(AppEvent event) { tokenPanelTreeModel.setZone((Zone) event.getNewValue()); } }, TabletopTool.ZoneEvent.Activated); return tree; }
From source file:net.rptools.maptool.client.ui.MapToolFrame.java
private JComponent createDrawTreePanel() { final JTree tree = new JTree(); drawablesPanel = new DrawablesPanel(); drawPanelTreeModel = new DrawPanelTreeModel(tree); tree.setModel(drawPanelTreeModel);//from ww w .j av a2 s . c om tree.setCellRenderer(new DrawPanelTreeCellRenderer()); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setContinuousLayout(true); splitPane.setTopComponent(new JScrollPane(tree)); splitPane.setBottomComponent(drawablesPanel); splitPane.setDividerLocation(100); // Add mouse Event for right click menu tree.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { TreePath path = tree.getPathForLocation(e.getX(), e.getY()); if (path == null) { return; } Object row = path.getLastPathComponent(); int rowIndex = tree.getRowForLocation(e.getX(), e.getY()); if (SwingUtilities.isLeftMouseButton(e)) { if (!SwingUtil.isShiftDown(e) && !SwingUtil.isControlDown(e)) { tree.clearSelection(); } tree.addSelectionInterval(rowIndex, rowIndex); if (row instanceof DrawnElement) { if (e.getClickCount() == 2) { DrawnElement de = (DrawnElement) row; getCurrentZoneRenderer() .centerOn(new ZonePoint((int) de.getDrawable().getBounds().getCenterX(), (int) de.getDrawable().getBounds().getCenterY())); } } int[] treeRows = tree.getSelectionRows(); java.util.Arrays.sort(treeRows); drawablesPanel.clearSelectedIds(); for (int i = 0; i < treeRows.length; i++) { TreePath p = tree.getPathForRow(treeRows[i]); if (p.getLastPathComponent() instanceof DrawnElement) { DrawnElement de = (DrawnElement) p.getLastPathComponent(); drawablesPanel.addSelectedId(de.getDrawable().getId()); } } } if (SwingUtilities.isRightMouseButton(e)) { if (!isRowSelected(tree.getSelectionRows(), rowIndex) && !SwingUtil.isShiftDown(e)) { tree.clearSelection(); tree.addSelectionInterval(rowIndex, rowIndex); drawablesPanel.clearSelectedIds(); } final int x = e.getX(); final int y = e.getY(); EventQueue.invokeLater(new Runnable() { public void run() { DrawnElement firstElement = null; Set<GUID> selectedDrawSet = new HashSet<GUID>(); for (TreePath path : tree.getSelectionPaths()) { if (path.getLastPathComponent() instanceof DrawnElement) { DrawnElement de = (DrawnElement) path.getLastPathComponent(); if (firstElement == null) { firstElement = de; } selectedDrawSet.add(de.getDrawable().getId()); } } if (!selectedDrawSet.isEmpty()) { try { new DrawPanelPopupMenu(selectedDrawSet, x, y, getCurrentZoneRenderer(), firstElement).showPopup(tree); } catch (IllegalComponentStateException icse) { log.info(tree.toString(), icse); } } } }); } } }); // Add Zone Change event MapTool.getEventDispatcher().addListener(new AppEventListener() { public void handleAppEvent(AppEvent event) { drawPanelTreeModel.setZone((Zone) event.getNewValue()); } }, MapTool.ZoneEvent.Activated); return splitPane; }
From source file:ru.apertum.qsystem.client.forms.FReception.java
private void tablePreRegMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tablePreRegMouseClicked final QService service = (QService) comboBoxServices.getSelectedItem(); if (evt.getClickCount() > 1 && tablePreReg.getSelectedRow() >= 0 && service != null && service.isLeaf()) { final FirstPreCell fc = (FirstPreCell) tablePreReg.getValueAt(tablePreReg.getSelectedRow(), 0); final GregorianCalendar gc = new GregorianCalendar(); gc.add(GregorianCalendar.HOUR_OF_DAY, 1); if (fc.getDate().before(gc.getTime())) { return; }/*from w ww. j a v a 2s . c om*/ if (fc.getAcust().getAdvanceTime() == null) { if (0 == JOptionPane.showConfirmDialog(this, getLocaleMessage("make.pre.reg ") + fc + "?", getLocaleMessage("pre.reg"), JOptionPane.YES_NO_OPTION)) { String inputData = null; if (service.getInput_required()) { inputData = (String) JOptionPane.showInputDialog(this, service.getInput_caption(), "***", 3, null, null, ""); //NOI18N if (inputData == null) { return; } } String comments = (String) JOptionPane.showInputDialog(this, getLocaleMessage("admin.comments"), "***", 3, null, null, ""); //NOI18N if (inputData == null) { inputData = ""; //NOI18N } final QAdvanceCustomer res; try { res = NetCommander.standInServiceAdvance(netProperty, service.getId(), fc.getDate(), -1, inputData, comments); } catch (Exception ex) { throw new ClientException(getLocaleMessage("admin.send_cmd_adv.err") + " " + ex); //NOI18N } if (res == null) { return; } // if (checkBoxPrintAdvTicket.isSelected()) { new Thread(() -> { FWelcome.printTicketAdvance(res, ((QService) treeServices.getModel().getRoot()) .getTextToLocale(QService.Field.NAME)); }).start(); } preRegChange(true); JOptionPane.showMessageDialog(this, getLocaleMessage("admin.client_adv_dialog.msg_1") + " \"" + service.getName() + "\". " + getLocaleMessage("admin.client_adv_dialog.msg_2") + " \"" + res.getId() + "\".", getLocaleMessage("admin.client_adv_dialog.title"), JOptionPane.INFORMATION_MESSAGE); } } else { if (0 == JOptionPane.showConfirmDialog(this, getLocaleMessage("clint.came") + fc + "?", getLocaleMessage("pre.reg.2"), JOptionPane.YES_NO_OPTION)) { final RpcStandInService res = NetCommander.standAndCheckAdvance(netProperty, fc.getAcust().getId()); if (res != null) { if (res.getMethod() == null) {// ?. ? ? ? ? QLog.l().logger().info(getLocaleMessage("print.ticket")); new Thread(() -> { FWelcome.printTicket(res.getResult(), ((QService) treeServices.getModel().getRoot()).getName()); }).start(); preRegChange(true); JOptionPane.showMessageDialog(this, getLocaleMessage("admin.client_adv_dialog.msg_3"), getLocaleMessage("admin.client_adv_dialog.title"), JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog(this, res.getMethod(), getLocaleMessage("admin.client_adv_dialog.title"), JOptionPane.ERROR_MESSAGE); } } } } } }