java.awt.event
public class MouseWheelEvent extends MouseEvent
Because of the special use for scrolling components, MouseWheelEvents often affect a different component than the one located at the point of the event. If the component under the mouse cursor does not accept wheel events, the event is passed to the first ancestor container which does. This is often a ScrollPane, which knows how to scroll. If an AWT component is built from a native widget that knows how to use mouse wheel events, that component will consume the event.
The two most common scroll types are "units" (lines at a time) or "blocks" (pages at a time). The initial setting is taken from the platform, although the user can adjust the setting at any time.
Since: 1.4
See Also: MouseWheelListener ScrollPane ScrollPane JScrollPane JScrollPane
UNKNOWN: updated to 1.4
Field Summary | |
---|---|
static int | WHEEL_BLOCK_SCROLL
Indicates scrolling by blocks (pages).
|
static int | WHEEL_UNIT_SCROLL
Indicates scrolling by units (lines).
|
Constructor Summary | |
---|---|
MouseWheelEvent(Component source, int id, long when, int modifiers, int x, int y, int clickCount, boolean popupTrigger, int scrollType, int scrollAmount, int wheelRotation)
Initializes a new instance of MouseWheelEvent with the
specified information. |
Method Summary | |
---|---|
int | getScrollAmount()
Returns the number of units to scroll in response to this event. |
int | getScrollType()
This method returns the scrolling pattern this event requests. |
int | getUnitsToScroll()
This is a convenience method which aids in a common listener for scrolling
a scrollpane (although this is already built into ScrollPane and
JScrollPane). |
int | getWheelRotation()
Gets the number of "clicks" the wheel was rotated. |
String | paramString()
Returns a string identifying this event. |
See Also: getScrollType
See Also: getScrollType
MouseWheelEvent
with the
specified information. Note that an invalid id leads to unspecified
results.
Parameters: source the source of the event id the event id when the timestamp of when the event occurred modifiers any modifier bits for this event x the X coordinate of the mouse point y the Y coordinate of the mouse point clickCount the number of mouse clicks for this event popupTrigger true if this event triggers a popup menu scrollType one of {@link #WHEEL_UNIT_SCROLL}, {@link #WHEEL_BLOCK_SCROLL} scrollAmount the number of units to scroll, ignored for block type wheelRotation the number of rotation "clicks"
Throws: IllegalArgumentException if source is null
See Also: MouseEvent
Returns: the number of scroll units, if defined
See Also: getScrollType
Returns: the scroll type
See Also: getUnitIncrement getBlockIncrement Scrollable Scrollable
This accounts for direction of scroll and amount of wheel movement, as interpreted by the platform settings.
Returns: the number of units to scroll
See Also: getScrollType getScrollAmount MouseWheelListener Adjustable getUnitIncrement Scrollable Scrollable ScrollPane ScrollPane JScrollPane JScrollPane
Returns: the number of rotation clicks
super.paramString() + ",scrollType=WHEEL_" +
(getScrollType() == WHEEL_UNIT_SCROLL ? "UNIT" : "BLOCK")
+ "_SCROLL,scrollAmount=" + getScrollAmount() + ",wheelRotation="
+ getWheelRotation()
.
Returns: a string identifying this event