本文整理汇总了Java中java.awt.event.MouseEvent.BUTTON3属性的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.BUTTON3属性的具体用法?Java MouseEvent.BUTTON3怎么用?Java MouseEvent.BUTTON3使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.event.MouseEvent
的用法示例。
在下文中一共展示了MouseEvent.BUTTON3属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mouseReleased
@Override
public void mouseReleased(MouseEvent e) {
int button = e.getButton();
// If not left-click, enforce selection at the given location
if (button != MouseEvent.BUTTON1) {
int index = list.locationToIndex(e.getPoint());
list.setSelectedIndex(index);
}
Object value = list.getSelectedValue();
// Middle-click to open editor
// Right-click to open context menu
if (value != null && button == MouseEvent.BUTTON2) {
// TODO: Allow users to choose custom middle-click actions
if (value instanceof FieldNode) {
display.openDefinition((FieldNode) value);
} else if (value instanceof MethodNode) {
display.openOpcodes((MethodNode) value);
}
} else if (button == MouseEvent.BUTTON3) {
createContextMenu(value, e.getX(), e.getY(), isMethodList(list));
}
}
示例2: getMouseClickedListener
private MouseListener getMouseClickedListener(final SVGContextMenu menu) {
return new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
Point p = new Point(e.getPoint());
SwingUtilities.convertPointToScreen(p, canvas);
if (menu.isVisible()) {
if (e.getButton() == MouseEvent.BUTTON3) {
menu.setLocation(p);
return;
}
else {
menu.setVisible(false);
}
}
if (e.getButton() == MouseEvent.BUTTON3) {
menu.setLocation(p);
menu.setVisible(true);
}
}
};
}
示例3: mouseClicked
@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: mouseReleased
@Override
public void mouseReleased(MouseEvent e) {
int button = e.getButton();
if (list.getSelectedIndices().length <= 1) {
// If not left-click, enforce selection at the given location
if (button != MouseEvent.BUTTON1) {
int index = list.locationToIndex(e.getPoint());
list.setSelectedIndex(index);
}
}
Object value = list.getSelectedValue();
if (value == null) {
return;
}
if (button == MouseEvent.BUTTON3) {
createContextMenu((AbstractInsnNode) value, e.getX(), e.getY());
} else if (button == MouseEvent.BUTTON2) {
createEdit((AbstractInsnNode) value, e.getX(), e.getY());
}
}
示例5: mousePressed
public final void mousePressed(MouseEvent e)
{
int internalButton = 0;
switch (e.getButton())
{
case MouseEvent.BUTTON1:
internalButton = 0;
break;
case MouseEvent.BUTTON3:
internalButton = 1;
break;
case MouseEvent.BUTTON2:
internalButton = 2;
break;
}
game.gameQueue.add(new MousePressEvent(SparkEvents.E_MOUSEDOWN,
internalButton, e.getX(), e.getY()));
}
示例6: mouseClicked
@Override
public void mouseClicked(MouseEvent e) {
FenetreGestionDeProjet fenetre = FenetreGestionDeProjet.getInstance();
// TODO Auto-generated method stub
if (e.getButton() == MouseEvent.BUTTON3) {
//System.out.println("modification et suppression");
JMenu contextMenu = new JMenu();
JMenuItem modifie = new JMenuItem("Modifier");
JMenuItem supprime = new JMenuItem("Supprimer");
contextMenu.add(modifie);
contextMenu.add(supprime);
contextMenu.setMenuLocation(e.getX(),e.getY());
fenetre.add(contextMenu);
contextMenu.setEnabled(true);
contextMenu.setVisible(true);
contextMenu.setPopupMenuVisible(true);
}
}
示例7: mousePressed
@Override
public State mousePressed (Widget widget, WidgetMouseEvent event) {
Point localLocation = event.getPoint();
if ((event.getButton() & (MouseEvent.BUTTON1 | MouseEvent.BUTTON2 | MouseEvent.BUTTON3)) != 0) {
if (process (widget, localLocation, event.getModifiersEx ()))
return State.CHAIN_ONLY;
}
return State.REJECTED;
}
示例8: mousePressed
public State mousePressed (Widget widget, WidgetMouseEvent event) {
if (isLocked()) {
return State.createLocked(widget, this);
}
Point localLocation = event.getPoint();
if (event.getButton() == MouseEvent.BUTTON1 || event.getButton() == MouseEvent.BUTTON2) {
invertSelection = (event.getModifiersEx() & MouseEvent.CTRL_DOWN_MASK) != 0;
if (provider.isSelectionAllowed(widget, localLocation, invertSelection)) {
aiming = provider.isAimingAllowed(widget, localLocation, invertSelection);
if (aiming) {
updateState(widget, localLocation);
return State.createLocked(widget, this);
} else {
provider.select(widget, localLocation, invertSelection);
return State.CHAIN_ONLY;
}
}
} else if (trapRightClick && event.getButton() == MouseEvent.BUTTON3) {
provider.select(widget, localLocation, false);
return State.CHAIN_ONLY;
}
return State.REJECTED;
}
示例9: mouseClicked
@Override
public void mouseClicked(MouseEvent e) {
if(e.getButton() == MouseEvent.BUTTON1) {
colar(e.getX(), e.getY());
ImageIcon icone = new ImageIcon(img);
background.setIcon(icone);
}else if(e.getButton() == MouseEvent.BUTTON3) {
copiar(e.getX(), e.getY());
}
}
示例10: mouseClicked
public void mouseClicked(MouseEvent ev) {
if (ev.getButton() == MouseEvent.BUTTON3) {
rightClick(ev);
} else {
}
}
示例11: mousePressed
@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);
}
示例12: mousePressed
/**
* {@inheritDoc}
*/
public void mousePressed(MouseEvent e) {
if (!e.getComponent().isEnabled()) return;
final Tile tile = canvas.convertToMapTile(e.getX(), e.getY());
final int me = (e.isPopupTrigger()) ? MouseEvent.BUTTON3
: e.getButton();
switch (me) {
case MouseEvent.BUTTON1:
// Record initial click point for purposes of dragging,
// @see CanvasMouseMotionListener#mouseDragged.
canvas.setDragPoint(e.getX(), e.getY());
// New click sequence? Remember position to use when timer expires
if (!doubleClickTimer.isRunning()) {
centerX = e.getX();
centerY = e.getY();
}
doubleClickTimer.start();
canvas.requestFocus();
break;
case MouseEvent.BUTTON2:
immediateGoto(tile);
break;
case MouseEvent.BUTTON3:
immediatePopup(tile, e.getX(), e.getY());
break;
default:
break;
}
}
示例13: mouseClicked
public void mouseClicked(MouseEvent ev) {
if (ev.getButton() == MouseEvent.BUTTON3) {
super.rightClick(ev);
return;
}
DPoint test = this.adjustMousePoint(ev.getX(), ev.getY());
for (int i = 0; i < data.getStationNames().length; i++) {
if (stationLabels[i] != null && stationLabels[i].contains(test)) {
showStation[i] = !showStation[i];
repaint();
}
}
}
示例14: mouseClicked
@Override
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON3) {
jtc.requestFocus();
showMenu(e.getX(), e.getY());
}
}
示例15: mouseClicked
public void mouseClicked(MouseEvent e) {
Point2D p = e.getPoint();
if (p == null)
return;
p = renderer.screenToWorld(p);
if (e.getButton() == MouseEvent.BUTTON1 && mouseInMode(Mode.EDITING)) {
// create a node
isCreatingVertex = true;
Vertex vertex = new Vertex();
vertex.setPosition(p);
UndoableAction action = new CreateVertexUndoableAction(
networkPanel.getNetwork(), vertex);
action.execute();
UndoableControl.getController().actionExecuted(action);
} else if (e.getButton() == MouseEvent.BUTTON3) {
Vertex v = pickSupport.pickVertex(p);
if (v != null) {
new EditVertexMenu(v, networkPanel.getNetwork(), e).show();
} else {
Edge edge = pickSupport.pickEdge(p);
if (edge != null) {
new EditEdgeMenu(edge, networkPanel.getNetwork(), e).show();
}
}
}
}