java.awt.event.MouseEvent#getClickCount()源码实例Demo

下面列出了java.awt.event.MouseEvent#getClickCount() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: ghidra   文件: DomainFilesPanel.java
@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();
}
 
源代码2 项目: chipster   文件: TreePanel.java
@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);
  		}
  	} 
  }
 
源代码3 项目: knopflerfish.org   文件: TableSorter.java
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);
}
 
源代码4 项目: magarena   文件: DeckEditorSplitPanel.java
@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);
    }
}
 
源代码5 项目: jdk8u_jdk   文件: TableSorter.java
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();
    }
}
 
源代码6 项目: PIPE   文件: AnnotationAction.java
/**
 * 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));
    }
}
 
源代码7 项目: PIPE   文件: ArcAction.java
/**
 * 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();
    }
}
 
源代码8 项目: pgptool   文件: HistoryQuickSearchView.java
@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;
	}
}
 
源代码9 项目: nextreports-designer   文件: DBBrowserTree.java
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());
		}
	}
 
源代码10 项目: jdk8u60   文件: MBeansTab.java
@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);
            }
        }
    }
}
 
源代码11 项目: java-swing-tips   文件: MainPanel.java
@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, ""));
    }
  }
}
 
源代码12 项目: freecol   文件: FreeColActionUI.java
@Override
public void mouseClicked(MouseEvent e) {
    if (e.getClickCount() > 1) {
        startBlinking();
        requestFocus();
    }
}
 
源代码13 项目: openjdk-jdk8u   文件: MBeansTab.java
@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);
            }
        }
    }
}
 
源代码14 项目: TencentKona-8   文件: RangeSlider.java
public void mouseClicked(MouseEvent e) {
    if (e.getClickCount() > 1) {
        // Double click
        int index = getCircleIndexFromPosition(e.getPoint().x);
        model.setPositions(index, index);
    }
}
 
源代码15 项目: open-ig   文件: VideoPlayer.java
/** 
 * 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();
	}
}
 
源代码16 项目: ghidra   文件: AnnotatedStringFieldMouseHandler.java
@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);
}
 
源代码17 项目: ghidra   文件: ErrorFieldMouseHandler.java
@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;
}
 
源代码18 项目: binnavi   文件: CAddressSelectionDialog.java
@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();
  }
}
 
源代码19 项目: open-ig   文件: AnimPlayList.java
/**
 * 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();
	}
}
 
源代码20 项目: pentaho-reporting   文件: TypedHeaderCellEditor.java
/**
 * 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;
}