本文整理汇总了Java中java.awt.event.MouseWheelEvent.getScrollAmount方法的典型用法代码示例。如果您正苦于以下问题:Java MouseWheelEvent.getScrollAmount方法的具体用法?Java MouseWheelEvent.getScrollAmount怎么用?Java MouseWheelEvent.getScrollAmount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.event.MouseWheelEvent
的用法示例。
在下文中一共展示了MouseWheelEvent.getScrollAmount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleWheelScrolling
import java.awt.event.MouseWheelEvent; //导入方法依赖的package包/类
public static void handleWheelScrolling(ScrollPane sp, MouseWheelEvent e) {
if (log.isLoggable(PlatformLogger.Level.FINER)) {
log.finer("x = " + e.getX() + ", y = " + e.getY() + ", src is " + e.getSource());
}
int increment = 0;
if (sp != null && e.getScrollAmount() != 0) {
Adjustable adj = getAdjustableToScroll(sp);
if (adj != null) {
increment = getIncrementFromAdjustable(adj, e);
if (log.isLoggable(PlatformLogger.Level.FINER)) {
log.finer("increment from adjustable(" + adj.getClass() + ") : " + increment);
}
scrollAdjustable(adj, increment);
}
}
}
示例2: scroll
import java.awt.event.MouseWheelEvent; //导入方法依赖的package包/类
private static void scroll(JScrollBar scroller, MouseWheelEvent event) {
if (event.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
int direction = event.getUnitsToScroll() < 0 ? -1 : 1;
int increment = scroller.getUnitIncrement(direction);
int amount = event.getScrollAmount();
int oldValue = scroller.getValue();
int newValue = oldValue + increment * amount * direction;
if (oldValue != newValue) scroller.setValue(newValue);
event.consume();
}
}
示例3: mouseWheelMoved
import java.awt.event.MouseWheelEvent; //导入方法依赖的package包/类
@Override
public void mouseWheelMoved(MouseWheelEvent mouseWheelEvent) {
if (mouseWheelEvent.getScrollAmount() == 0) {
return;
}
vertical.setValue(vertical.getValue() + 3 * mouseWheelEvent.getWheelRotation());
}
示例4: 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());
}