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