本文整理汇总了Java中java.awt.event.MouseEvent.BUTTON2属性的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.BUTTON2属性的具体用法?Java MouseEvent.BUTTON2怎么用?Java MouseEvent.BUTTON2使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.event.MouseEvent
的用法示例。
在下文中一共展示了MouseEvent.BUTTON2属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isRightMouseButton
static boolean isRightMouseButton(MouseEvent me) {
int numButtons = ((Integer)getDefaultToolkit().getDesktopProperty("awt.mouse.numButtons")).intValue();
switch (me.getID()) {
case MouseEvent.MOUSE_PRESSED:
case MouseEvent.MOUSE_RELEASED:
return ((numButtons == 2 && me.getButton() == MouseEvent.BUTTON2) ||
(numButtons > 2 && me.getButton() == MouseEvent.BUTTON3));
case MouseEvent.MOUSE_ENTERED:
case MouseEvent.MOUSE_EXITED:
case MouseEvent.MOUSE_CLICKED:
case MouseEvent.MOUSE_DRAGGED:
return ((numButtons == 2 && (me.getModifiersEx() & InputEvent.BUTTON2_DOWN_MASK) != 0) ||
(numButtons > 2 && (me.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) != 0));
}
return false;
}
示例2: 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());
}
}
示例3: mouseReleased
@Override
public void mouseReleased(MouseEvent e) {
if ((e.getButton() == MouseEvent.BUTTON1 && viewport.zoomButtonVisible
&& AutoZoomButtonClicked(viewport.getSize(), e.getX() * getZoomFactor() - getHorizzontalScrollBar(),
e.getY() * getZoomFactor() - getVerticalScrollBar())
&& viewport.zoomButtonColor != defaultzoomButtonColor)
|| e.getButton() == MouseEvent.BUTTON2 && e.getClickCount() == 2) {
autoZoomCenter();
} else {
if (drag_tool != null) {
drag_tool.mouseReleased(Canvas.this, getGraphics(), e);
drag_tool = null;
}
Tool tool = proj.getTool();
if (tool != null) {
tool.mouseMoved(Canvas.this, getGraphics(), e);
setCursor(tool.getCursor());
}
completeAction();
}
viewport.zoomButtonColor = defaultzoomButtonColor;
}
示例4: mouseReleased
public void mouseReleased(MouseEvent evt) {
switch (evt.getButton()) {
case MouseEvent.BUTTON1: {
mouseLeft = false;
break;
}
case MouseEvent.BUTTON2: {
mouseRight = false;
break;
}
}
if (!mouseLeft && !mouseRight) {
mouseMode = MouseMode.NONE;
}
// This is the last mouse action, so keep track of it.
mouseEnd.x = evt.getX();
mouseEnd.y = evt.getY();
mouseDelta = new Point(mouseEnd.x - mouseStart.x, mouseEnd.y
- mouseStart.y);
repaint();
}
示例5: mouseReleased
@Override
public void mouseReleased(MouseEvent arg0) {
if (arg0.getButton() == MouseEvent.BUTTON2 && arg0.getClickCount() == 1) {
setCursor(cursor);
this.mooving = false;
} else if ((arg0.getButton() == MouseEvent.BUTTON1 && viewport.zoomButtonVisible
&& com.cburch.logisim.gui.main.Canvas.AutoZoomButtonClicked(viewport.getSize(),
arg0.getX() * getZoomFactor() - getHorizzontalScrollBar(),
arg0.getY() * getZoomFactor() - getVerticalScrollBar())
&& viewport.zoomButtonColor != com.cburch.logisim.gui.main.Canvas.defaultzoomButtonColor)
|| arg0.getButton() == MouseEvent.BUTTON2 && arg0.getClickCount() == 2) {
autoZoomCenter();
}
if (getTool() == null)
setTool(tempTool);
viewport.zoomButtonColor = com.cburch.logisim.gui.main.Canvas.defaultzoomButtonColor;
}
示例6: mouseReleased
@Override
public void mouseReleased(MouseEvent e)
{
if(!inst.GAME_STARTED)
{
;
}
else
{
switch(e.getButton())
{
case MouseEvent.BUTTON1:
{
keys.MOUSE_LEFT = false;
break;
}
case MouseEvent.BUTTON2:
{
keys.MOUSE_RIGHT = false;
break;
}
case MouseEvent.BUTTON3:
{
break;
}
}
}
}
示例7: mouseReleased
public void mouseReleased(MouseEvent e) {
Topology tp = node.getTopology();
if (tp.hasProperty("refreshMode"))
tp.setRefreshMode((Topology.RefreshMode) tp.getProperty("refreshMode"));
if (destination != null) {
node.getTopology().addLink(new Link(node, destination));
destination = null;
} else {
if (e.getButton() == MouseEvent.BUTTON3)
node.getTopology().removeNode(node);
else if (e.getButton() == MouseEvent.BUTTON2)
node.getTopology().selectNode(node);
}
currentButton = 1;
}
示例8: mousePressed
@Override
public void mousePressed(MouseEvent event) {
if(event.getButton() == MouseEvent.BUTTON1) {
isPrimaryPressed = true;
} else if(event.getButton() == MouseEvent.BUTTON2) {
isMiddlePressed = true;
} else if(event.getButton() == MouseEvent.BUTTON3) {
isSecondaryPressed = true;
}
}
示例9: 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;
}
示例10: mousePressed
public State mousePressed (Widget widget, WidgetMouseEvent event) {
if (event.getButton () == MouseEvent.BUTTON1 || event.getButton () == MouseEvent.BUTTON2) {
stateModel.toggleBooleanState ();
return State.CONSUMED;
}
return State.REJECTED;
}
示例11: mouseClicked
@Override
public void mouseClicked(MouseEvent e) {
// no operation
if( e.getButton() == MouseEvent.BUTTON2 ) {
slideBar.userMiddleClickedSlidingButton(e.getComponent());
}
}
示例12: mousePressed
@Override
public State mousePressed(Widget widget, WidgetMouseEvent event) {
if (event.getClickCount() == 1) {
if (event.getButton() == MouseEvent.BUTTON1 || event.getButton() == MouseEvent.BUTTON2) {
addNode("node" + nodeCounter++).setPreferredLocation(widget.convertLocalToScene(event.getPoint()));
return State.CONSUMED;
}
}
return State.REJECTED;
}
示例13: storeMouseDown
private void storeMouseDown(int button) {
if (button == MouseEvent.BUTTON1) {
button1Pressed = true;
}
if (button == MouseEvent.BUTTON2) {
button2Pressed = true;
}
if (button == MouseEvent.BUTTON3) {
button3Pressed = true;
}
}
示例14: getButtons
public int getButtons() {
if (button1Pressed) {
return MouseEvent.BUTTON1;
}
if (button2Pressed) {
return MouseEvent.BUTTON2;
}
if (button3Pressed) {
return MouseEvent.BUTTON3;
}
return 0;
}
示例15: mousePressed
/**
* {@inheritDoc}
*/
public void mousePressed(MouseEvent e) {
if (!e.getComponent().isEnabled()) return;
final Tile tile = canvas.convertToMapTile(e.getX(), e.getY());
final Unit unit = getGUI().getActiveUnit();
final int me = (e.isPopupTrigger()) ? MouseEvent.BUTTON3
: e.getButton();
if (canvas.isGotoStarted()) canvas.stopGoto();
switch (me) {
case MouseEvent.BUTTON1: // Drag and selection
// Enable dragging with button 1
// @see CanvasMouseMotionListener#mouseDragged
canvas.setDragPoint(e.getX(), e.getY());
canvas.requestFocus();
break;
case MouseEvent.BUTTON2: // Immediate goto
if (tile != null && unit != null) {
canvas.startGoto();
getGUI().updateGotoPath(tile);
getGUI().traverseGotoPath();
}
break;
case MouseEvent.BUTTON3: // Immediate tile popup
canvas.showTilePopup(tile, e.getX(), e.getY());
break;
default:
break;
}
}