本文整理匯總了Java中java.awt.event.MouseEvent.getClickCount方法的典型用法代碼示例。如果您正苦於以下問題:Java MouseEvent.getClickCount方法的具體用法?Java MouseEvent.getClickCount怎麽用?Java MouseEvent.getClickCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.event.MouseEvent
的用法示例。
在下文中一共展示了MouseEvent.getClickCount方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: mouseClicked
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
@Override
public void mouseClicked(MouseEvent e) {
JTree tree = (JTree) e.getSource();
Point p = e.getPoint();
int row = tree.getRowForLocation(e.getX(), e.getY());
TreePath path = tree.getPathForRow(row);
// if path exists and mouse is clicked exactly once
if (path != null) {
FileNode node = (FileNode) path.getLastPathComponent();
Rectangle chRect = DeletedListRenderer.getCheckBoxRectangle();
Rectangle rowRect = tree.getPathBounds(path);
chRect.setLocation(chRect.x + rowRect.x, chRect.y + rowRect.y);
if (e.getClickCount() == 1 && chRect.contains(p)) {
boolean isSelected = !(node.isSelected());
node.setSelected(isSelected);
((DefaultTreeModel) tree.getModel()).nodeChanged(node);
if (row == 0) {
tree.revalidate();
}
tree.repaint();
}
}
}
示例2: addMouseListenerToHeaderInTable
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
public void addMouseListenerToHeaderInTable(JTable table) {
final TableSorter sorter = this;
final JTable tableView = table;
tableView.setColumnSelectionAllowed(false);
MouseAdapter listMouseListener = new MouseAdapter() {
boolean ascending = false;
public void mouseClicked(MouseEvent e) {
TableColumnModel columnModel = tableView.getColumnModel();
int viewColumn = columnModel.getColumnIndexAtX(e.getX());
int column = tableView.convertColumnIndexToModel(viewColumn);
if (e.getClickCount() == 1 && column != -1) {
//System.out.println("Sorting ...");
//int shiftPressed = e.getModifiers()&InputEvent.SHIFT_MASK;
//boolean ascending = (shiftPressed == 0);
if (column == sortBy)
ascending = !ascending;
else
ascending = true;
sorter.sortByColumn(column, ascending);
tableView.getTableHeader().updateUI();
}
}
};
JTableHeader th = tableView.getTableHeader();
th.addMouseListener(listMouseListener);
}
示例3: mouseClicked
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
@Override
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) {
if (e.getClickCount() > 1) {
String id = plotter.getIdForPos(e.getX(), e.getY());
if (id != null) {
ObjectVisualizer visualizer = ObjectVisualizerService.getVisualizerForObject(dataTable);
visualizer.startVisualization(id);
}
}
} else if (e.getButton() == MouseEvent.BUTTON3) {
plotter.setDrawRange(-1, -1, -1, -1);
pressStart = null;
plotter.setDragBounds(-1, -1, -1, -1);
}
}
示例4: mousePressed
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
@Override protected void mousePressed(MouseEvent me) {
// Ignore double clicks on non-leaf tree nodes
if (me.getButton() == MouseEvent.BUTTON1 && me.getModifiersEx() == InputEvent.BUTTON1_DOWN_MASK) {
if (me.getClickCount() == 1) {
return;
}
TreePath path = ((JTree) component).getPathForRow(row);
if (path != null) {
Object lastPathComponent = path.getLastPathComponent();
if (lastPathComponent instanceof TreeNode) {
TreeNode node = (TreeNode) lastPathComponent;
if (node.getChildCount() != 0) {
return;
}
}
}
}
// Ignore Ctrl+Clicks used to select the nodes
if (me.getButton() == MouseEvent.BUTTON1 && isMenuShortcutKeyDown(me)) {
return;
}
if (me.getButton() != MouseEvent.BUTTON1) {
focusLost(null);
}
super.mousePressed(me);
}
示例5: mouseClicked
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
@Override
public void mouseClicked(MouseEvent e)
{
if (e.getClickCount() == 2)
{
processSelection();
}
}
示例6: mousePressed
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
protected void mousePressed(MouseEvent me) {
if (me.getButton() == MouseEvent.BUTTON1 && me.getClickCount() == 1 && !me.isAltDown() && !me.isMetaDown()
&& !me.isAltGraphDown() && !me.isControlDown()) {
mouseButton1Pressed(me);
} else {
recorder.recordClick2(this, me, true);
}
}
示例7: mousePressed
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
@Override
public void mousePressed(MouseEvent e) {
if(e.isPopupTrigger() && type != null && feature != null) {
createPopup(e);
mousePopup.show(e.getComponent(), e.getX(), e.getY());
} else if(e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
updateQuery();
}
}
示例8: mouseClicked
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
@Override
public void mouseClicked(MouseEvent event) {
if (event.isControlDown() && SwingUtilities.isLeftMouseButton(event) && event.getClickCount() == 1) {
int row = tableau.rowAtPoint(event.getPoint());
listSelection.addSelectionInterval(row, row);
}
}
示例9: mousePressed
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
@Override
public void mousePressed(MouseEvent evt) {
TreePath path = getPathForLocation(evt.getX(), evt.getY());
if (path != null) {
if (evt.getButton() == MouseEvent.BUTTON3 && !isRowSelected(getRowForPath(path))) {
setSelectionPath(path);
}
DisplayKind toDisplay = null;
Object lastComponent = path.getLastPathComponent();
if (lastComponent instanceof RuleTreeNode) {
toDisplay = DisplayKind.RULE;
} else if (lastComponent instanceof RecipeTreeNode) {
toDisplay = DisplayKind.CONTROL;
} else if (lastComponent instanceof MatchTreeNode
&& getSimulatorModel().getDisplay() != DisplayKind.LTS) {
toDisplay = DisplayKind.STATE;
}
if (evt.getClickCount() == 1 && toDisplay != null) {
getSimulatorModel().setDisplay(toDisplay);
} else if (evt.getClickCount() == 2 && toDisplay != null) {
if (toDisplay.hasResource()) {
getActions().getEditAction(toDisplay.getResource())
.execute();
}
}
}
maybeShowPopup(evt);
}
示例10: mouseClicked
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
getActions().getEditSystemPropertiesAction()
.execute();
}
}
示例11: mouseClicked
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
public void mouseClicked(MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2) {
int row = fieldsListTable.rowAtPoint(e.getPoint());
if (e.getX() >= fieldsListTable.getTree().getRowBounds(row).x -
fieldsListTable.getTreeCellOffsetX() && row != -1) {
HeapWalkerNode node = (HeapWalkerNode) fieldsListTable.getTree().
getPathForRow(row).getLastPathComponent();
if (node instanceof HeapWalkerInstanceNode)
performDefaultAction();
}
}
}
示例12: mouseClicked
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
@Override
public void mouseClicked(MouseEvent e) {
if (e.isControlDown() || e.isShiftDown() && e.getButton() != MouseEvent.BUTTON3) {
VideoViewer viewer = VideoViewer.INSTANCE;
if (viewer.PLAYER.isPlaying()) {
Dimension dim = viewer.PLAYER.getVideoDimension();
if (e.getButton() == MouseEvent.BUTTON1) {
updateVisibility(false);
} else {
updateVisibility(true);
}
YtQueueFrame frame = YtQueueFrame.INSTANCE;
int x = frame.getX(), y = frame.getY(), w = frame.getWidth(), h = frame.getHeight();
double simillar = dim.width / (double) w;
if (e.isShiftDown()) {
simillar = 1;
}
dim.width = (int) (dim.width / simillar);
dim.height = (int) (dim.height / simillar) +
(e.getButton() != MouseEvent.BUTTON2 ? 0 : SearchPanel.INSTANCE.getHeight() +
VideoViewer.INSTANCE.MANAGER.getHeight());
frame.setBounds(x + w - dim.width, y + h - dim.height, dim.width, dim.height);
}
}
if (e.getClickCount() == 2) {
if (e.getButton() == MouseEvent.BUTTON1) {
updateVisibility(!SearchPanel.INSTANCE.isVisible());
} else if (e.getButton() == MouseEvent.BUTTON2) {
close();
}
}
}
示例13: mouseClicked
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
public void mouseClicked(MouseEvent e) {
if ((e.getClickCount() == 2) && (taskTable.getSelectedRow() > -1)){
// ignore "tree" column
//if(taskTable.getSelectedColumn() == 1) return;
editTaskB_actionPerformed(null);
}
}
示例14: mouseClicked
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
@Override
public void mouseClicked(MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e)) {
if (e.getClickCount() == 2) {
openAction.actionPerformed(new ActionEvent(IOObjectCacheEntryPanel.this, ActionEvent.ACTION_PERFORMED,
null));
}
}
}
示例15: mouseClicked
import java.awt.event.MouseEvent; //導入方法依賴的package包/類
public void mouseClicked(MouseEvent e) {
int selRow = tree.getRowForLocation(e.getX(), e.getY());
if ((selRow != -1) && SwingUtilities.isLeftMouseButton(e) && (e.getClickCount() % 2) == 0) {
FileObject fileObject = bf.getSelectedFileObject();
if (fileObject != null && !fileObject.isFolder())
options[0].doClick();
}
}