本文整理汇总了Java中java.awt.event.MouseEvent.CTRL_DOWN_MASK属性的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.CTRL_DOWN_MASK属性的具体用法?Java MouseEvent.CTRL_DOWN_MASK怎么用?Java MouseEvent.CTRL_DOWN_MASK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.event.MouseEvent
的用法示例。
在下文中一共展示了MouseEvent.CTRL_DOWN_MASK属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
private boolean process (Widget widget, Point localLocation, int modifiers) {
boolean ctrl = (modifiers & MouseEvent.CTRL_DOWN_MASK) != 0;
boolean shift = (modifiers & MouseEvent.SHIFT_DOWN_MASK) != 0;
ContiguousSelectEvent.SelectionType type = ctrl
? (shift ? ContiguousSelectEvent.SelectionType.ADDITIVE_CONTIGUOUS : ContiguousSelectEvent.SelectionType.ADDITIVE_NON_CONTIGUOUS)
: (shift ? ContiguousSelectEvent.SelectionType.REPLACE_CONTIGUOUS : ContiguousSelectEvent.SelectionType.REPLACE_NON_CONTIGUOUS);
ContiguousSelectEvent providerEvent = ContiguousSelectEvent.create (previousWidget, previousLocalLocation, widget, localLocation, type);
if (provider.isSelectionAllowed (providerEvent)) {
provider.select(providerEvent);
if (! shift) {
previousWidget = widget;
previousLocalLocation = localLocation;
}
return true;
}
return false;
}
示例2: mouseMoved
@Override
public void mouseMoved(MouseEvent e) {
// Mac OSX simulates with ctrl + mouse 1 the second mouse button hence no dragging events get fired.
//
if (isPlatformOsx()) {
if (!movementEnabled || !isMoving)
return;
// Is only the selected mouse button pressed?
if (e.getModifiersEx() == MouseEvent.CTRL_DOWN_MASK) {
Point p = e.getPoint();
if (lastDragPoint != null) {
int diffx = lastDragPoint.x - p.x;
int diffy = lastDragPoint.y - p.y;
map.moveMap(diffx, diffy);
}
lastDragPoint = p;
}
}
}
示例3: 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;
}
示例4: canDrag
private boolean canDrag(MouseEvent e) {
return (e.getModifiersEx() & (MouseEvent.ALT_DOWN_MASK |
MouseEvent.ALT_GRAPH_DOWN_MASK |
MouseEvent.CTRL_DOWN_MASK |
MouseEvent.META_DOWN_MASK |
MouseEvent.SHIFT_DOWN_MASK)) == 0;
}
示例5: mousePressed
@Override
public State mousePressed(Widget widget, WidgetMouseEvent event) {
if (event.getClickCount() >= 2 && (event.getButton() == MouseEvent.BUTTON1 || event.getButton() == MouseEvent.BUTTON2)) {
boolean invert = (event.getModifiersEx() & MouseEvent.CTRL_DOWN_MASK) != 0;
Point point = event.getPoint();
if (provider.isSelectionAllowed(widget, point, invert)) {
provider.select(widget, point, invert);
return State.CHAIN_ONLY;
}
}
return State.REJECTED;
}