本文整理汇总了Java中java.awt.event.MouseWheelEvent.getModifiers方法的典型用法代码示例。如果您正苦于以下问题:Java MouseWheelEvent.getModifiers方法的具体用法?Java MouseWheelEvent.getModifiers怎么用?Java MouseWheelEvent.getModifiers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.event.MouseWheelEvent
的用法示例。
在下文中一共展示了MouseWheelEvent.getModifiers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PrintPreviewComponent
import java.awt.event.MouseWheelEvent; //导入方法依赖的package包/类
public PrintPreviewComponent(RamusPrintable printable, int columnCount,
GUIFramework framework) {
this.printable = printable;
this.columnCount = columnCount;
this.framework = framework;
MouseWheelListener l = new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
if (e.getModifiers() == KeyEvent.CTRL_MASK) {
double r = e.getWheelRotation();
double zoom = getZoom() - 0.2 * r;
setCurrentZoom(zoom);
} else {
Rectangle rect = getVisibleRect();
scrollRectToVisible(new Rectangle(rect.x, rect.y
+ e.getWheelRotation() * 150, rect.width,
rect.height));
}
}
}
};
this.addMouseWheelListener(l);
layout = Options.getInteger("PREVIW_LAYOUT", PREV_LAYOUT_GRID);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
setCurrentZoom(Options.getDouble("PREV_ZOOM", 1d));
}
});
setCurrentZoom(Options.getDouble("PREV_ZOOM", 1d));
}
示例2: mouseWheelMoved
import java.awt.event.MouseWheelEvent; //导入方法依赖的package包/类
@Override
public void mouseWheelMoved(MouseWheelEvent evt) {
int shortcut = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
if ((evt.getModifiers() & shortcut) == shortcut && !evt.isShiftDown() && !evt.isAltDown()
&& !evt.isAltGraphDown()) {
if (evt.getWheelRotation() < 0) {
increaseZoom();
} else {
decreaseZoom();
}
} else {
evt.getComponent().getParent().dispatchEvent(evt);
}
}
示例3: cloneEvent
import java.awt.event.MouseWheelEvent; //导入方法依赖的package包/类
private MouseWheelEvent cloneEvent(MouseWheelEvent e) {
return new MouseWheelEvent(getParentScrollPane(), e.getID(), e
.getWhen(), e.getModifiers(), 1, 1, e
.getClickCount(), false, e.getScrollType(), e
.getScrollAmount(), e.getWheelRotation());
}