本文整理匯總了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());
}