本文整理汇总了Java中java.awt.event.MouseWheelEvent.getModifiersEx方法的典型用法代码示例。如果您正苦于以下问题:Java MouseWheelEvent.getModifiersEx方法的具体用法?Java MouseWheelEvent.getModifiersEx怎么用?Java MouseWheelEvent.getModifiersEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.event.MouseWheelEvent
的用法示例。
在下文中一共展示了MouseWheelEvent.getModifiersEx方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mouseWheelMoved
import java.awt.event.MouseWheelEvent; //导入方法依赖的package包/类
/**
* Pass mouse events into the event queue.
*
* @param mouse mouse event received
*/
public void mouseWheelMoved(final MouseWheelEvent mouse) {
int modifiers = mouse.getModifiersEx();
boolean eventMouse1 = false;
boolean eventMouse2 = false;
boolean eventMouse3 = false;
boolean mouseWheelUp = false;
boolean mouseWheelDown = false;
if ((modifiers & MouseEvent.BUTTON1_DOWN_MASK) != 0) {
eventMouse1 = true;
}
if ((modifiers & MouseEvent.BUTTON2_DOWN_MASK) != 0) {
eventMouse2 = true;
}
if ((modifiers & MouseEvent.BUTTON3_DOWN_MASK) != 0) {
eventMouse3 = true;
}
mouse1 = eventMouse1;
mouse2 = eventMouse2;
mouse3 = eventMouse3;
int x = screen.textColumn(mouse.getX());
int y = screen.textRow(mouse.getY());
if (mouse.getWheelRotation() > 0) {
mouseWheelDown = true;
}
if (mouse.getWheelRotation() < 0) {
mouseWheelUp = true;
}
TMouseEvent mouseEvent = new TMouseEvent(TMouseEvent.Type.MOUSE_DOWN,
x, y, x, y, mouse1, mouse2, mouse3, mouseWheelUp, mouseWheelDown);
synchronized (eventQueue) {
eventQueue.add(mouseEvent);
}
synchronized (listener) {
listener.notifyAll();
}
}