Java Code Examples for java.awt.event.MouseEvent#getClickCount()
The following examples show how to use
java.awt.event.MouseEvent#getClickCount() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DomainFilesPanel.java From ghidra with Apache License 2.0 | 6 votes |
@Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() != 1) { return; } JList list = (JList) e.getSource(); int index = list.locationToIndex(e.getPoint()); if (index < 0) { return; } boolean selected = checkboxes[index].isSelected(); checkboxes[index].setSelected(!selected); // The following repaint() is to get the check box state to get refreshed on the screen. // Prior to adding this the check box did not refresh the display of its state in the // list when selected multiple times in a row. It only seemed to repaint when focus // was lost. list.repaint(); }
Example 2
Source File: TreePanel.java From chipster with MIT License | 6 votes |
@Override public void mousePressed(MouseEvent e) { maybeShowPopup(e); // double click if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() > 1) { DataItem selectedItem = this.getSelectedElementFrom(e); if (selectedItem instanceof DataBean) { application.visualiseWithBestMethod(FrameType.MAIN); } else if (selectedItem instanceof DataFolder) { // select all child beans DataFolder folder = (DataFolder)selectedItem; application.getSelectionManager().clearAll(false, this); application.getSelectionManager().selectMultiple(folder.getChildren(), this); } } }
Example 3
Source File: TableSorter.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public void mouseClicked(MouseEvent e) { int viewColumn = columnModel.getColumnIndexAtX(e.getX()); int column = tableView.convertColumnIndexToModel(viewColumn); if (e.getClickCount() == 1 && column != -1) { if (tableView instanceof XTable) { XTable attrs = (XTable) tableView; // inform the table view that the rows are going to be sorted // against the values in a given column. This gives the // chance to the table view to close its editor - if needed. // attrs.sortRequested(column); } tableView.invalidate(); sortByColumn(column); tableView.validate(); tableView.repaint(); } }
Example 4
Source File: DeckEditorSplitPanel.java From magarena with GNU General Public License v3.0 | 6 votes |
@Override public void mouseClicked(final MouseEvent e) { if (e.getClickCount() > 1) { if (e.getButton() == MouseEvent.BUTTON1) { removeSelectedFromDeck(); } else if (e.getButton() == MouseEvent.BUTTON3) { final List<MagicCardDefinition> deckCards = deckTable.getSelectedCards(); if (deckCards.size() > 0) { deck.addAll(deckCards); updateDeck(); } } } if (e.getButton() == MouseEvent.BUTTON3) { final JTable table = (JTable) (e.getSource()); final int row = table.rowAtPoint(e.getPoint()); table.clearSelection(); table.addRowSelectionInterval(row, row); } }
Example 5
Source File: TableSorter.java From knopflerfish.org with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void addMouseListenerToHeaderInTable(JTable table) { final TableSorter sorter = this; final JTable tableView = table; tableView.setColumnSelectionAllowed(false); final MouseAdapter listMouseListener = new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { final TableColumnModel columnModel = tableView.getColumnModel(); final int viewColumn = columnModel.getColumnIndexAtX(e.getX()); final int column = tableView.convertColumnIndexToModel(viewColumn); if (e.getClickCount() == 1 && column != -1) { //System.out.println("Sorting ..."); final int shiftPressed = e.getModifiers()&InputEvent.SHIFT_MASK; final boolean ascending = (shiftPressed == 0); sorter.sortByColumn(column, ascending); } } }; final JTableHeader th = tableView.getTableHeader(); th.addMouseListener(listMouseListener); }
Example 6
Source File: CAddressSelectionDialog.java From binnavi with Apache License 2.0 | 5 votes |
@Override public void mousePressed(final MouseEvent event) { // Update the selected element on double-click if ((event.getButton() == 1) && (event.getClickCount() == 2)) { setSelectedElement(); } // Close the dialog on double-click if (m_selectionResult != null) { closeDialog(); } }
Example 7
Source File: AnnotationAction.java From PIPE with MIT License | 5 votes |
/** * Called when this action is selected and the user has pressed on the canvas * Adds a new annotation and registers an undo event for its addition. * @param event mouse event * @param petriNetController controller for the petri net */ @Override public void doAction(MouseEvent event, PetriNetController petriNetController) { if (event.getClickCount() > 0) { Point point = event.getPoint(); Annotation annotation = getAnnotation(point, petriNetController); PetriNet net = petriNetController.getPetriNet(); registerUndoEvent(new AddPetriNetObject(annotation, net)); } }
Example 8
Source File: ErrorFieldMouseHandler.java From ghidra with Apache License 2.0 | 5 votes |
@Override public boolean fieldElementClicked(Object clickedObject, Navigatable sourceNavigatable, ProgramLocation location, MouseEvent mouseEvent, ServiceProvider serviceProvider) { if (mouseEvent.getClickCount() != 2 || mouseEvent.getButton() != MouseEvent.BUTTON1) { return false; } ErrorListingField errorField = (ErrorListingField) clickedObject; String fieldName = errorField.getFieldFactory().getFieldName(); Msg.showError(this, null, "Listing Field Exception", "Exception occurred while rendering '" + fieldName + "' field", errorField.getThrowable()); return true; }
Example 9
Source File: AnnotatedStringFieldMouseHandler.java From ghidra with Apache License 2.0 | 5 votes |
@Override public boolean fieldElementClicked(Object clickedObject, Navigatable sourceNavigatable, ProgramLocation location, MouseEvent mouseEvent, ServiceProvider serviceProvider) { if (mouseEvent.getClickCount() != 2 || mouseEvent.getButton() != MouseEvent.BUTTON1) { return false; } return ((AnnotatedTextFieldElement) clickedObject).handleMouseClicked(sourceNavigatable, serviceProvider); }
Example 10
Source File: VideoPlayer.java From open-ig with GNU Lesser General Public License v3.0 | 5 votes |
/** * Do mouse clicked. * @param e the event */ protected void doMouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { int idx = videoTable.getSelectedRow(); idx = videoTable.convertRowIndexToModel(idx); currentVideo = videoModel.rows.get(idx); position.setValue(0); doPlay(); } }
Example 11
Source File: RangeSlider.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public void mouseClicked(MouseEvent e) { if (e.getClickCount() > 1) { // Double click int index = getCircleIndexFromPosition(e.getPoint().x); model.setPositions(index, index); } }
Example 12
Source File: MBeansTab.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public void mousePressed(MouseEvent e) { if (e.getClickCount() == 1) { int selRow = tree.getRowForLocation(e.getX(), e.getY()); if (selRow != -1) { TreePath selPath = tree.getPathForLocation(e.getX(), e.getY()); DefaultMutableTreeNode node = (DefaultMutableTreeNode) selPath.getLastPathComponent(); if (sheet.isMBeanNode(node)) { tree.expandPath(selPath); } } } }
Example 13
Source File: FreeColActionUI.java From freecol with GNU General Public License v2.0 | 5 votes |
@Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() > 1) { startBlinking(); requestFocus(); } }
Example 14
Source File: MainPanel.java From java-swing-tips with MIT License | 5 votes |
@Override public void mouseClicked(MouseEvent e) { boolean isDoubleClick = e.getClickCount() >= 2; if (isDoubleClick) { Component src = e.getComponent(); Dimension dim = src.getSize(); rect.setBounds(getTitleBounds(src, 0, 0, dim.width, dim.height)); if (rect.contains(e.getPoint())) { startEditing.actionPerformed(new ActionEvent(src, ActionEvent.ACTION_PERFORMED, "")); } } }
Example 15
Source File: MBeansTab.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public void mousePressed(MouseEvent e) { if (e.getClickCount() == 1) { int selRow = tree.getRowForLocation(e.getX(), e.getY()); if (selRow != -1) { TreePath selPath = tree.getPathForLocation(e.getX(), e.getY()); DefaultMutableTreeNode node = (DefaultMutableTreeNode) selPath.getLastPathComponent(); if (sheet.isMBeanNode(node)) { tree.expandPath(selPath); } } } }
Example 16
Source File: DBBrowserTree.java From nextreports-designer with Apache License 2.0 | 5 votes |
private void selectionProcedure(DBBrowserNode selectedNode, MouseEvent e) { ViewProcedureColumnsInfoAction infoAction = new ViewProcedureColumnsInfoAction(selectedNode.getDBObject()); if (e.getClickCount() == 2) { infoAction.actionPerformed(null); } else { 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()); } }
Example 17
Source File: HistoryQuickSearchView.java From pgptool with GNU General Public License v3.0 | 5 votes |
@Override public void mouseClicked(MouseEvent e) { super.mouseClicked(e); if (!isAttached()) { return; } if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) { pm.actionOpen.actionPerformed(UiUtils.actionEvent(table, pm.actionOpen)); return; } }
Example 18
Source File: ArcAction.java From PIPE with MIT License | 5 votes |
/** * Changes the temporary arc's end point * * @param event mouse event that has just been fired * @param petriNetController current petri net controller for the tab showing */ @Override public void doAction(MouseEvent event, PetriNetController petriNetController) { if (temporaryArcView != null) { temporaryArcView.setEnd(event.getPoint()); if (event.getClickCount() > 0) { Point point = event.getPoint(); temporaryArcView.addIntermediatePoint(new ArcPoint(point, event.isShiftDown())); } PetriNetTab tab = petriNetController.getPetriNetTab(); tab.validate(); tab.repaint(); } }
Example 19
Source File: AnimPlayList.java From open-ig with GNU Lesser General Public License v3.0 | 4 votes |
/** * Action on mouse click within the table. * @param e the mouse event */ protected void doMouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() > 1) { doPlaySelected(); } }
Example 20
Source File: TypedHeaderCellEditor.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 3 votes |
/** * Asks the editor if it can start editing using <code>anEvent</code>. <code>anEvent</code> is in the invoking * component coordinate system. The editor can not assume the Component returned by * <code>getCellEditorComponent</code> is installed. This method is intended for the use of client to avoid the cost * of setting up and installing the editor component if editing is not possible. If editing can be started this method * returns true. * * @param anEvent the event the editor should use to consider whether to begin editing or not * @return true if editing can be started * @see #shouldSelectCell */ public boolean isCellEditable( final EventObject anEvent ) { if ( anEvent instanceof MouseEvent ) { final MouseEvent mouseEvent = (MouseEvent) anEvent; return mouseEvent.getClickCount() >= 2 && mouseEvent.getButton() == MouseEvent.BUTTON1; } return true; }