java.awt.event
Class MouseWheelEvent

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.util.EventObject sample code for java.util.EventObject definition code for java.util.EventObject 
      extended by java.awt.AWTEvent sample code for java.awt.AWTEvent definition code for java.awt.AWTEvent 
          extended by java.awt.event.ComponentEvent sample code for java.awt.event.ComponentEvent definition code for java.awt.event.ComponentEvent 
              extended by java.awt.event.InputEvent sample code for java.awt.event.InputEvent definition code for java.awt.event.InputEvent 
                  extended by java.awt.event.MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent 
                      extended by java.awt.event.MouseWheelEvent
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable

public class MouseWheelEvent
extends MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent

An event which indicates that the mouse wheel was rotated in a component.

A wheel mouse is a mouse which has a wheel in place of the middle button. This wheel can be rotated towards or away from the user. Mouse wheels are most often used for scrolling, though other uses are possible.

A MouseWheelEvent object is passed to every MouseWheelListener object which registered to receive the "interesting" mouse events using the component's addMouseWheelListener method. Each such listener object gets a MouseEvent containing the mouse event.

Due to the mouse wheel's special relationship to scrolling Components, MouseWheelEvents are delivered somewhat differently than other MouseEvents. This is because while other MouseEvents usually affect a change on the Component directly under the mouse cursor (for instance, when clicking a button), MouseWheelEvents often have an effect away from the mouse cursor (moving the wheel while over a Component inside a ScrollPane should scroll one of the Scrollbars on the ScrollPane).

MouseWheelEvents start delivery from the Component underneath the mouse cursor. If MouseWheelEvents are not enabled on the Component, the event is delivered to the first ancestor Container with MouseWheelEvents enabled. This will usually be a ScrollPane with wheel scrolling enabled. The source Component and x,y coordinates will be relative to the event's final destination (the ScrollPane). This allows a complex GUI to be installed without modification into a ScrollPane, and for all MouseWheelEvents to be delivered to the ScrollPane for scrolling.

Some AWT Components are implemented using native widgets which display their own scrollbars and handle their own scrolling. The particular Components for which this is true will vary from platform to platform. When the mouse wheel is moved over one of these Components, the event is delivered straight to the native widget, and not propagated to ancestors.

Platforms offer customization of the amount of scrolling that should take place when the mouse wheel is moved. The two most common settings are to scroll a certain number of "units" (commonly lines of text in a text-based component) or an entire "block" (similar to page-up/page-down). The MouseWheelEvent offers methods for conforming to the underlying platform settings. These platform settings can be changed at any time by the user. MouseWheelEvents reflect the most recent settings.

Since:
1.4
See Also:
MouseWheelListener sample code for java.awt.event.MouseWheelListener definition code for java.awt.event.MouseWheelListener , ScrollPane sample code for java.awt.ScrollPane definition code for java.awt.ScrollPane , ScrollPane.setWheelScrollingEnabled(boolean) sample code for java.awt.ScrollPane.setWheelScrollingEnabled(boolean) definition code for java.awt.ScrollPane.setWheelScrollingEnabled(boolean) , JScrollPane sample code for javax.swing.JScrollPane definition code for javax.swing.JScrollPane , JScrollPane.setWheelScrollingEnabled(boolean) sample code for javax.swing.JScrollPane.setWheelScrollingEnabled(boolean) definition code for javax.swing.JScrollPane.setWheelScrollingEnabled(boolean) , Serialized Form

Field Summary
static int WHEEL_BLOCK_SCROLL sample code for java.awt.event.MouseWheelEvent.WHEEL_BLOCK_SCROLL definition code for java.awt.event.MouseWheelEvent.WHEEL_BLOCK_SCROLL
          Constant representing scrolling by a "block" (like scrolling with page-up, page-down keys)
static int WHEEL_UNIT_SCROLL sample code for java.awt.event.MouseWheelEvent.WHEEL_UNIT_SCROLL definition code for java.awt.event.MouseWheelEvent.WHEEL_UNIT_SCROLL
          Constant representing scrolling by "units" (like scrolling with the arrow keys)
 
Fields inherited from class java.awt.event.MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent
BUTTON1 sample code for java.awt.event.MouseEvent.BUTTON1 definition code for java.awt.event.MouseEvent.BUTTON1 , BUTTON2 sample code for java.awt.event.MouseEvent.BUTTON2 definition code for java.awt.event.MouseEvent.BUTTON2 , BUTTON3 sample code for java.awt.event.MouseEvent.BUTTON3 definition code for java.awt.event.MouseEvent.BUTTON3 , MOUSE_CLICKED sample code for java.awt.event.MouseEvent.MOUSE_CLICKED definition code for java.awt.event.MouseEvent.MOUSE_CLICKED , MOUSE_DRAGGED sample code for java.awt.event.MouseEvent.MOUSE_DRAGGED definition code for java.awt.event.MouseEvent.MOUSE_DRAGGED , MOUSE_ENTERED sample code for java.awt.event.MouseEvent.MOUSE_ENTERED definition code for java.awt.event.MouseEvent.MOUSE_ENTERED , MOUSE_EXITED sample code for java.awt.event.MouseEvent.MOUSE_EXITED definition code for java.awt.event.MouseEvent.MOUSE_EXITED , MOUSE_FIRST sample code for java.awt.event.MouseEvent.MOUSE_FIRST definition code for java.awt.event.MouseEvent.MOUSE_FIRST , MOUSE_LAST sample code for java.awt.event.MouseEvent.MOUSE_LAST definition code for java.awt.event.MouseEvent.MOUSE_LAST , MOUSE_MOVED sample code for java.awt.event.MouseEvent.MOUSE_MOVED definition code for java.awt.event.MouseEvent.MOUSE_MOVED , MOUSE_PRESSED sample code for java.awt.event.MouseEvent.MOUSE_PRESSED definition code for java.awt.event.MouseEvent.MOUSE_PRESSED , MOUSE_RELEASED sample code for java.awt.event.MouseEvent.MOUSE_RELEASED definition code for java.awt.event.MouseEvent.MOUSE_RELEASED , MOUSE_WHEEL sample code for java.awt.event.MouseEvent.MOUSE_WHEEL definition code for java.awt.event.MouseEvent.MOUSE_WHEEL , NOBUTTON sample code for java.awt.event.MouseEvent.NOBUTTON definition code for java.awt.event.MouseEvent.NOBUTTON
 
Fields inherited from class java.awt.event.InputEvent sample code for java.awt.event.InputEvent definition code for java.awt.event.InputEvent
ALT_DOWN_MASK sample code for java.awt.event.InputEvent.ALT_DOWN_MASK definition code for java.awt.event.InputEvent.ALT_DOWN_MASK , ALT_GRAPH_DOWN_MASK sample code for java.awt.event.InputEvent.ALT_GRAPH_DOWN_MASK definition code for java.awt.event.InputEvent.ALT_GRAPH_DOWN_MASK , ALT_GRAPH_MASK sample code for java.awt.event.InputEvent.ALT_GRAPH_MASK definition code for java.awt.event.InputEvent.ALT_GRAPH_MASK , ALT_MASK sample code for java.awt.event.InputEvent.ALT_MASK definition code for java.awt.event.InputEvent.ALT_MASK , BUTTON1_DOWN_MASK sample code for java.awt.event.InputEvent.BUTTON1_DOWN_MASK definition code for java.awt.event.InputEvent.BUTTON1_DOWN_MASK , BUTTON1_MASK sample code for java.awt.event.InputEvent.BUTTON1_MASK definition code for java.awt.event.InputEvent.BUTTON1_MASK , BUTTON2_DOWN_MASK sample code for java.awt.event.InputEvent.BUTTON2_DOWN_MASK definition code for java.awt.event.InputEvent.BUTTON2_DOWN_MASK , BUTTON2_MASK sample code for java.awt.event.InputEvent.BUTTON2_MASK definition code for java.awt.event.InputEvent.BUTTON2_MASK , BUTTON3_DOWN_MASK sample code for java.awt.event.InputEvent.BUTTON3_DOWN_MASK definition code for java.awt.event.InputEvent.BUTTON3_DOWN_MASK , BUTTON3_MASK sample code for java.awt.event.InputEvent.BUTTON3_MASK definition code for java.awt.event.InputEvent.BUTTON3_MASK , CTRL_DOWN_MASK sample code for java.awt.event.InputEvent.CTRL_DOWN_MASK definition code for java.awt.event.InputEvent.CTRL_DOWN_MASK , CTRL_MASK sample code for java.awt.event.InputEvent.CTRL_MASK definition code for java.awt.event.InputEvent.CTRL_MASK , META_DOWN_MASK sample code for java.awt.event.InputEvent.META_DOWN_MASK definition code for java.awt.event.InputEvent.META_DOWN_MASK , META_MASK sample code for java.awt.event.InputEvent.META_MASK definition code for java.awt.event.InputEvent.META_MASK , SHIFT_DOWN_MASK sample code for java.awt.event.InputEvent.SHIFT_DOWN_MASK definition code for java.awt.event.InputEvent.SHIFT_DOWN_MASK , SHIFT_MASK sample code for java.awt.event.InputEvent.SHIFT_MASK definition code for java.awt.event.InputEvent.SHIFT_MASK
 
Fields inherited from class java.awt.event.ComponentEvent sample code for java.awt.event.ComponentEvent definition code for java.awt.event.ComponentEvent
COMPONENT_FIRST sample code for java.awt.event.ComponentEvent.COMPONENT_FIRST definition code for java.awt.event.ComponentEvent.COMPONENT_FIRST , COMPONENT_HIDDEN sample code for java.awt.event.ComponentEvent.COMPONENT_HIDDEN definition code for java.awt.event.ComponentEvent.COMPONENT_HIDDEN , COMPONENT_LAST sample code for java.awt.event.ComponentEvent.COMPONENT_LAST definition code for java.awt.event.ComponentEvent.COMPONENT_LAST , COMPONENT_MOVED sample code for java.awt.event.ComponentEvent.COMPONENT_MOVED definition code for java.awt.event.ComponentEvent.COMPONENT_MOVED , COMPONENT_RESIZED sample code for java.awt.event.ComponentEvent.COMPONENT_RESIZED definition code for java.awt.event.ComponentEvent.COMPONENT_RESIZED , COMPONENT_SHOWN sample code for java.awt.event.ComponentEvent.COMPONENT_SHOWN definition code for java.awt.event.ComponentEvent.COMPONENT_SHOWN
 
Fields inherited from class java.awt.AWTEvent sample code for java.awt.AWTEvent definition code for java.awt.AWTEvent
ACTION_EVENT_MASK sample code for java.awt.AWTEvent.ACTION_EVENT_MASK definition code for java.awt.AWTEvent.ACTION_EVENT_MASK , ADJUSTMENT_EVENT_MASK sample code for java.awt.AWTEvent.ADJUSTMENT_EVENT_MASK definition code for java.awt.AWTEvent.ADJUSTMENT_EVENT_MASK , COMPONENT_EVENT_MASK sample code for java.awt.AWTEvent.COMPONENT_EVENT_MASK definition code for java.awt.AWTEvent.COMPONENT_EVENT_MASK , consumed sample code for java.awt.AWTEvent.consumed definition code for java.awt.AWTEvent.consumed , CONTAINER_EVENT_MASK sample code for java.awt.AWTEvent.CONTAINER_EVENT_MASK definition code for java.awt.AWTEvent.CONTAINER_EVENT_MASK , FOCUS_EVENT_MASK sample code for java.awt.AWTEvent.FOCUS_EVENT_MASK definition code for java.awt.AWTEvent.FOCUS_EVENT_MASK , HIERARCHY_BOUNDS_EVENT_MASK sample code for java.awt.AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK definition code for java.awt.AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK , HIERARCHY_EVENT_MASK sample code for java.awt.AWTEvent.HIERARCHY_EVENT_MASK definition code for java.awt.AWTEvent.HIERARCHY_EVENT_MASK , id sample code for java.awt.AWTEvent.id definition code for java.awt.AWTEvent.id , INPUT_METHOD_EVENT_MASK sample code for java.awt.AWTEvent.INPUT_METHOD_EVENT_MASK definition code for java.awt.AWTEvent.INPUT_METHOD_EVENT_MASK , INVOCATION_EVENT_MASK sample code for java.awt.AWTEvent.INVOCATION_EVENT_MASK definition code for java.awt.AWTEvent.INVOCATION_EVENT_MASK , ITEM_EVENT_MASK sample code for java.awt.AWTEvent.ITEM_EVENT_MASK definition code for java.awt.AWTEvent.ITEM_EVENT_MASK , KEY_EVENT_MASK sample code for java.awt.AWTEvent.KEY_EVENT_MASK definition code for java.awt.AWTEvent.KEY_EVENT_MASK , MOUSE_EVENT_MASK sample code for java.awt.AWTEvent.MOUSE_EVENT_MASK definition code for java.awt.AWTEvent.MOUSE_EVENT_MASK , MOUSE_MOTION_EVENT_MASK sample code for java.awt.AWTEvent.MOUSE_MOTION_EVENT_MASK definition code for java.awt.AWTEvent.MOUSE_MOTION_EVENT_MASK , MOUSE_WHEEL_EVENT_MASK sample code for java.awt.AWTEvent.MOUSE_WHEEL_EVENT_MASK definition code for java.awt.AWTEvent.MOUSE_WHEEL_EVENT_MASK , PAINT_EVENT_MASK sample code for java.awt.AWTEvent.PAINT_EVENT_MASK definition code for java.awt.AWTEvent.PAINT_EVENT_MASK , RESERVED_ID_MAX sample code for java.awt.AWTEvent.RESERVED_ID_MAX definition code for java.awt.AWTEvent.RESERVED_ID_MAX , TEXT_EVENT_MASK sample code for java.awt.AWTEvent.TEXT_EVENT_MASK definition code for java.awt.AWTEvent.TEXT_EVENT_MASK , WINDOW_EVENT_MASK sample code for java.awt.AWTEvent.WINDOW_EVENT_MASK definition code for java.awt.AWTEvent.WINDOW_EVENT_MASK , WINDOW_FOCUS_EVENT_MASK sample code for java.awt.AWTEvent.WINDOW_FOCUS_EVENT_MASK definition code for java.awt.AWTEvent.WINDOW_FOCUS_EVENT_MASK , WINDOW_STATE_EVENT_MASK sample code for java.awt.AWTEvent.WINDOW_STATE_EVENT_MASK definition code for java.awt.AWTEvent.WINDOW_STATE_EVENT_MASK
 
Fields inherited from class java.util.EventObject sample code for java.util.EventObject definition code for java.util.EventObject
source sample code for java.util.EventObject.source definition code for java.util.EventObject.source
 
Constructor Summary
MouseWheelEvent sample code for java.awt.event.MouseWheelEvent.MouseWheelEvent(java.awt.Component, int, long, int, int, int, int, boolean, int, int, int) definition code for java.awt.event.MouseWheelEvent.MouseWheelEvent(java.awt.Component, int, long, int, int, int, int, boolean, int, int, int) (Component sample code for java.awt.Component definition code for java.awt.Component  source, int id, long when, int modifiers, int x, int y, int clickCount, boolean popupTrigger, int scrollType, int scrollAmount, int wheelRotation)
          Constructs a MouseWheelEvent object with the specified source component, type, modifiers, coordinates, scroll type, scroll amount, and wheel rotation.
 
Method Summary
 int getScrollAmount sample code for java.awt.event.MouseWheelEvent.getScrollAmount() definition code for java.awt.event.MouseWheelEvent.getScrollAmount() ()
          Returns the number of units that should be scrolled in response to this event.
 int getScrollType sample code for java.awt.event.MouseWheelEvent.getScrollType() definition code for java.awt.event.MouseWheelEvent.getScrollType() ()
          Returns the type of scrolling that should take place in response to this event.
 int getUnitsToScroll sample code for java.awt.event.MouseWheelEvent.getUnitsToScroll() definition code for java.awt.event.MouseWheelEvent.getUnitsToScroll() ()
          This is a convenience method to aid in the implementation of the common-case MouseWheelListener - to scroll a ScrollPane or JScrollPane by an amount which conforms to the platform settings.
 int getWheelRotation sample code for java.awt.event.MouseWheelEvent.getWheelRotation() definition code for java.awt.event.MouseWheelEvent.getWheelRotation() ()
          Returns the number of "clicks" the mouse wheel was rotated.
 String sample code for java.lang.String definition code for java.lang.String paramString sample code for java.awt.event.MouseWheelEvent.paramString() definition code for java.awt.event.MouseWheelEvent.paramString() ()
          Returns a parameter string identifying this event.
 
Methods inherited from class java.awt.event.MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent
getButton sample code for java.awt.event.MouseEvent.getButton() definition code for java.awt.event.MouseEvent.getButton() , getClickCount sample code for java.awt.event.MouseEvent.getClickCount() definition code for java.awt.event.MouseEvent.getClickCount() , getMouseModifiersText sample code for java.awt.event.MouseEvent.getMouseModifiersText(int) definition code for java.awt.event.MouseEvent.getMouseModifiersText(int) , getPoint sample code for java.awt.event.MouseEvent.getPoint() definition code for java.awt.event.MouseEvent.getPoint() , getX sample code for java.awt.event.MouseEvent.getX() definition code for java.awt.event.MouseEvent.getX() , getY sample code for java.awt.event.MouseEvent.getY() definition code for java.awt.event.MouseEvent.getY() , isPopupTrigger sample code for java.awt.event.MouseEvent.isPopupTrigger() definition code for java.awt.event.MouseEvent.isPopupTrigger() , translatePoint sample code for java.awt.event.MouseEvent.translatePoint(int, int) definition code for java.awt.event.MouseEvent.translatePoint(int, int)
 
Methods inherited from class java.awt.event.InputEvent sample code for java.awt.event.InputEvent definition code for java.awt.event.InputEvent
consume sample code for java.awt.event.InputEvent.consume() definition code for java.awt.event.InputEvent.consume() , getModifiers sample code for java.awt.event.InputEvent.getModifiers() definition code for java.awt.event.InputEvent.getModifiers() , getModifiersEx sample code for java.awt.event.InputEvent.getModifiersEx() definition code for java.awt.event.InputEvent.getModifiersEx() , getModifiersExText sample code for java.awt.event.InputEvent.getModifiersExText(int) definition code for java.awt.event.InputEvent.getModifiersExText(int) , getWhen sample code for java.awt.event.InputEvent.getWhen() definition code for java.awt.event.InputEvent.getWhen() , isAltDown sample code for java.awt.event.InputEvent.isAltDown() definition code for java.awt.event.InputEvent.isAltDown() , isAltGraphDown sample code for java.awt.event.InputEvent.isAltGraphDown() definition code for java.awt.event.InputEvent.isAltGraphDown() , isConsumed sample code for java.awt.event.InputEvent.isConsumed() definition code for java.awt.event.InputEvent.isConsumed() , isControlDown sample code for java.awt.event.InputEvent.isControlDown() definition code for java.awt.event.InputEvent.isControlDown() , isMetaDown sample code for java.awt.event.InputEvent.isMetaDown() definition code for java.awt.event.InputEvent.isMetaDown() , isShiftDown sample code for java.awt.event.InputEvent.isShiftDown() definition code for java.awt.event.InputEvent.isShiftDown()
 
Methods inherited from class java.awt.event.ComponentEvent sample code for java.awt.event.ComponentEvent definition code for java.awt.event.ComponentEvent
getComponent sample code for java.awt.event.ComponentEvent.getComponent() definition code for java.awt.event.ComponentEvent.getComponent()
 
Methods inherited from class java.awt.AWTEvent sample code for java.awt.AWTEvent definition code for java.awt.AWTEvent
getID sample code for java.awt.AWTEvent.getID() definition code for java.awt.AWTEvent.getID() , setSource sample code for java.awt.AWTEvent.setSource(java.lang.Object) definition code for java.awt.AWTEvent.setSource(java.lang.Object) , toString sample code for java.awt.AWTEvent.toString() definition code for java.awt.AWTEvent.toString()
 
Methods inherited from class java.util.EventObject sample code for java.util.EventObject definition code for java.util.EventObject
getSource sample code for java.util.EventObject.getSource() definition code for java.util.EventObject.getSource()
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

WHEEL_UNIT_SCROLL sample code for java.awt.event.MouseWheelEvent.WHEEL_UNIT_SCROLL

public static final int WHEEL_UNIT_SCROLL
Constant representing scrolling by "units" (like scrolling with the arrow keys)

See Also:
getScrollType() sample code for java.awt.event.MouseWheelEvent.getScrollType() definition code for java.awt.event.MouseWheelEvent.getScrollType() , Constant Field Values

WHEEL_BLOCK_SCROLL sample code for java.awt.event.MouseWheelEvent.WHEEL_BLOCK_SCROLL

public static final int WHEEL_BLOCK_SCROLL
Constant representing scrolling by a "block" (like scrolling with page-up, page-down keys)

See Also:
getScrollType() sample code for java.awt.event.MouseWheelEvent.getScrollType() definition code for java.awt.event.MouseWheelEvent.getScrollType() , Constant Field Values
Constructor Detail

MouseWheelEvent sample code for java.awt.event.MouseWheelEvent(java.awt.Component, int, long, int, int, int, int, boolean, int, int, int) definition code for java.awt.event.MouseWheelEvent(java.awt.Component, int, long, int, int, int, int, boolean, int, int, int)

public MouseWheelEvent(Component sample code for java.awt.Component definition code for java.awt.Component  source,
                       int id,
                       long when,
                       int modifiers,
                       int x,
                       int y,
                       int clickCount,
                       boolean popupTrigger,
                       int scrollType,
                       int scrollAmount,
                       int wheelRotation)
Constructs a MouseWheelEvent object with the specified source component, type, modifiers, coordinates, scroll type, scroll amount, and wheel rotation.

Note that passing in an invalid id results in unspecified behavior. This method throws an IllegalArgumentException if source is null.

Parameters:
source - the Component that originated the event
id - the integer that identifies the event
when - a long that gives the time the event occurred
modifiers - the modifier keys down during event (shift, ctrl, alt, meta)
x - the horizontal x coordinate for the mouse location
y - the vertical y coordinate for the mouse location
clickCount - the number of mouse clicks associated with event
popupTrigger - a boolean, true if this event is a trigger for a popup-menu
scrollType - the type of scrolling which should take place in response to this event; valid values are WHEEL_UNIT_SCROLL and WHEEL_BLOCK_SCROLL
scrollAmount - for scrollType WHEEL_UNIT_SCROLL, the number of units to be scrolled
wheelRotation - the amount that the mouse wheel was rotated (the number of "clicks")
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if source is null
See Also:
MouseEvent.MouseEvent(java.awt.Component, int, long, int, int, int, int, boolean) sample code for java.awt.event.MouseEvent.MouseEvent(java.awt.Component, int, long, int, int, int, int, boolean) definition code for java.awt.event.MouseEvent.MouseEvent(java.awt.Component, int, long, int, int, int, int, boolean)
Method Detail

getScrollType sample code for java.awt.event.MouseWheelEvent.getScrollType() definition code for java.awt.event.MouseWheelEvent.getScrollType()

public int getScrollType()
Returns the type of scrolling that should take place in response to this event. This is determined by the native platform. Legal values are:

Returns:
either MouseWheelEvent.WHEEL_UNIT_SCROLL or MouseWheelEvent.WHEEL_BLOCK_SCROLL, depending on the configuration of the native platform.
See Also:
Adjustable.getUnitIncrement() sample code for java.awt.Adjustable.getUnitIncrement() definition code for java.awt.Adjustable.getUnitIncrement() , Adjustable.getBlockIncrement() sample code for java.awt.Adjustable.getBlockIncrement() definition code for java.awt.Adjustable.getBlockIncrement() , Scrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, int) sample code for javax.swing.Scrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, int) definition code for javax.swing.Scrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, int) , Scrollable.getScrollableBlockIncrement(java.awt.Rectangle, int, int) sample code for javax.swing.Scrollable.getScrollableBlockIncrement(java.awt.Rectangle, int, int) definition code for javax.swing.Scrollable.getScrollableBlockIncrement(java.awt.Rectangle, int, int)

getScrollAmount sample code for java.awt.event.MouseWheelEvent.getScrollAmount() definition code for java.awt.event.MouseWheelEvent.getScrollAmount()

public int getScrollAmount()
Returns the number of units that should be scrolled in response to this event. Only valid if getScrollType returns MouseWheelEvent.WHEEL_UNIT_SCROLL

Returns:
number of units to scroll, or an undefined value if getScrollType returns MouseWheelEvent.WHEEL_BLOCK_SCROLL
See Also:
getScrollType() sample code for java.awt.event.MouseWheelEvent.getScrollType() definition code for java.awt.event.MouseWheelEvent.getScrollType()

getWheelRotation sample code for java.awt.event.MouseWheelEvent.getWheelRotation() definition code for java.awt.event.MouseWheelEvent.getWheelRotation()

public int getWheelRotation()
Returns the number of "clicks" the mouse wheel was rotated.

Returns:
negative values if the mouse wheel was rotated up/away from the user, and positive values if the mouse wheel was rotated down/ towards the user

getUnitsToScroll sample code for java.awt.event.MouseWheelEvent.getUnitsToScroll() definition code for java.awt.event.MouseWheelEvent.getUnitsToScroll()

public int getUnitsToScroll()
This is a convenience method to aid in the implementation of the common-case MouseWheelListener - to scroll a ScrollPane or JScrollPane by an amount which conforms to the platform settings. (Note, however, that ScrollPane and JScrollPane already have this functionality built in.)

This method returns the number of units to scroll when scroll type is MouseWheelEvent.WHEEL_UNIT_SCROLL, and should only be called if getScrollType returns MouseWheelEvent.WHEEL_UNIT_SCROLL.

Direction of scroll, amount of wheel movement, and platform settings for wheel scrolling are all accounted for. This method does not and cannot take into account value of the Adjustable/Scrollable unit increment, as this will vary among scrolling components.

A simplified example of how this method might be used in a listener:

 
  mouseWheelMoved(MouseWheelEvent event) {
      ScrollPane sp = getScrollPaneFromSomewhere(); 
      Adjustable adj = sp.getVAdjustable()
      if (MouseWheelEvent.getScrollType() == WHEEL_UNIT_SCROLL) {
          int totalScrollAmount =
              event.getUnitsToScroll() *
              adj.getUnitIncrement();
          adj.setValue(adj.getValue() + totalScrollAmount);
      }
  }
 

Returns:
the number of units to scroll based on the direction and amount of mouse wheel rotation, and on the wheel scrolling settings of the native platform
See Also:
getScrollType() sample code for java.awt.event.MouseWheelEvent.getScrollType() definition code for java.awt.event.MouseWheelEvent.getScrollType() , getScrollAmount() sample code for java.awt.event.MouseWheelEvent.getScrollAmount() definition code for java.awt.event.MouseWheelEvent.getScrollAmount() , MouseWheelListener sample code for java.awt.event.MouseWheelListener definition code for java.awt.event.MouseWheelListener , Adjustable sample code for java.awt.Adjustable definition code for java.awt.Adjustable , Adjustable.getUnitIncrement() sample code for java.awt.Adjustable.getUnitIncrement() definition code for java.awt.Adjustable.getUnitIncrement() , Scrollable sample code for javax.swing.Scrollable definition code for javax.swing.Scrollable , Scrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, int) sample code for javax.swing.Scrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, int) definition code for javax.swing.Scrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, int) , ScrollPane sample code for java.awt.ScrollPane definition code for java.awt.ScrollPane , ScrollPane.setWheelScrollingEnabled(boolean) sample code for java.awt.ScrollPane.setWheelScrollingEnabled(boolean) definition code for java.awt.ScrollPane.setWheelScrollingEnabled(boolean) , JScrollPane sample code for javax.swing.JScrollPane definition code for javax.swing.JScrollPane , JScrollPane.setWheelScrollingEnabled(boolean) sample code for javax.swing.JScrollPane.setWheelScrollingEnabled(boolean) definition code for javax.swing.JScrollPane.setWheelScrollingEnabled(boolean)

paramString sample code for java.awt.event.MouseWheelEvent.paramString() definition code for java.awt.event.MouseWheelEvent.paramString()

public String sample code for java.lang.String definition code for java.lang.String  paramString()
Returns a parameter string identifying this event. This method is useful for event-logging and for debugging.

Overrides:
paramString sample code for java.awt.event.MouseEvent.paramString() definition code for java.awt.event.MouseEvent.paramString() in class MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent
Returns:
a string identifying the event and its attributes