< prev index next >
src/java.desktop/share/classes/java/awt/event/MouseWheelEvent.java
Print this page
*** 34,47 ****
* <P>
* 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.
* <P>
! * A MouseWheelEvent object is passed to every <code>MouseWheelListener</code>
* object which registered to receive the "interesting" mouse events using the
! * component's <code>addMouseWheelListener</code> method. Each such listener
! * object gets a <code>MouseEvent</code> containing the mouse event.
* <P>
* 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
--- 34,47 ----
* <P>
* 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.
* <P>
! * A MouseWheelEvent object is passed to every {@code MouseWheelListener}
* object which registered to receive the "interesting" mouse events using the
! * component's {@code addMouseWheelListener} method. Each such listener
! * object gets a {@code MouseEvent} containing the mouse event.
* <P>
* 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
*** 75,89 ****
* (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.
* <P>
! * The <code>MouseWheelEvent</code> class includes methods for
* getting the number of "clicks" by which the mouse wheel is rotated.
* The {@link #getWheelRotation} method returns the integer number
* of "clicks" corresponding to the number of notches by which the wheel was
! * rotated. In addition to this method, the <code>MouseWheelEvent</code>
* class provides the {@link #getPreciseWheelRotation} method which returns
* a double number of "clicks" in case a partial rotation occurred.
* The {@link #getPreciseWheelRotation} method is useful if a mouse supports
* a high-resolution wheel, such as a freely rotating wheel with no
* notches. Applications can benefit by using this method to process
--- 75,89 ----
* (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.
* <P>
! * The {@code MouseWheelEvent} class includes methods for
* getting the number of "clicks" by which the mouse wheel is rotated.
* The {@link #getWheelRotation} method returns the integer number
* of "clicks" corresponding to the number of notches by which the wheel was
! * rotated. In addition to this method, the {@code MouseWheelEvent}
* class provides the {@link #getPreciseWheelRotation} method which returns
* a double number of "clicks" in case a partial rotation occurred.
* The {@link #getPreciseWheelRotation} method is useful if a mouse supports
* a high-resolution wheel, such as a freely rotating wheel with no
* notches. Applications can benefit by using this method to process
*** 158,178 ****
*/
private static final long serialVersionUID = 6459879390515399677L;
/**
! * Constructs a <code>MouseWheelEvent</code> object with the
* specified source component, type, modifiers, coordinates,
* scroll type, scroll amount, and wheel rotation.
* <p>Absolute coordinates xAbs and yAbs are set to source's location on screen plus
* relative coordinates x and y. xAbs and yAbs are set to zero if the source is not showing.
! * <p>Note that passing in an invalid <code>id</code> results in
* unspecified behavior. This method throws an
! * <code>IllegalArgumentException</code> if <code>source</code>
! * is <code>null</code>.
*
! * @param source the <code>Component</code> that originated
* the event
* @param id the integer that identifies the event
* @param when a long that gives the time the event occurred
* @param modifiers the modifier keys down during event
* (shift, ctrl, alt, meta)
--- 158,178 ----
*/
private static final long serialVersionUID = 6459879390515399677L;
/**
! * Constructs a {@code MouseWheelEvent} object with the
* specified source component, type, modifiers, coordinates,
* scroll type, scroll amount, and wheel rotation.
* <p>Absolute coordinates xAbs and yAbs are set to source's location on screen plus
* relative coordinates x and y. xAbs and yAbs are set to zero if the source is not showing.
! * <p>Note that passing in an invalid {@code id} results in
* unspecified behavior. This method throws an
! * {@code IllegalArgumentException} if {@code source}
! * is {@code null}.
*
! * @param source the {@code Component} that originated
* the event
* @param id the integer that identifies the event
* @param when a long that gives the time the event occurred
* @param modifiers the modifier keys down during event
* (shift, ctrl, alt, meta)
*** 181,198 ****
* @param clickCount the number of mouse clicks associated with event
* @param popupTrigger a boolean, true if this event is a trigger for a
* popup-menu
* @param scrollType the type of scrolling which should take place in
* response to this event; valid values are
! * <code>WHEEL_UNIT_SCROLL</code> and
! * <code>WHEEL_BLOCK_SCROLL</code>
! * @param scrollAmount for scrollType <code>WHEEL_UNIT_SCROLL</code>,
* the number of units to be scrolled
* @param wheelRotation the integer number of "clicks" by which the mouse
* wheel was rotated
*
! * @throws IllegalArgumentException if <code>source</code> is null
* @see MouseEvent#MouseEvent(java.awt.Component, int, long, int, int, int, int, boolean)
* @see MouseEvent#MouseEvent(java.awt.Component, int, long, int, int, int, int, int, int, boolean, int)
*/
public MouseWheelEvent (Component source, int id, long when, int modifiers,
int x, int y, int clickCount, boolean popupTrigger,
--- 181,198 ----
* @param clickCount the number of mouse clicks associated with event
* @param popupTrigger a boolean, true if this event is a trigger for a
* popup-menu
* @param scrollType the type of scrolling which should take place in
* response to this event; valid values are
! * {@code WHEEL_UNIT_SCROLL} and
! * {@code WHEEL_BLOCK_SCROLL}
! * @param scrollAmount for scrollType {@code WHEEL_UNIT_SCROLL},
* the number of units to be scrolled
* @param wheelRotation the integer number of "clicks" by which the mouse
* wheel was rotated
*
! * @throws IllegalArgumentException if {@code source} is null
* @see MouseEvent#MouseEvent(java.awt.Component, int, long, int, int, int, int, boolean)
* @see MouseEvent#MouseEvent(java.awt.Component, int, long, int, int, int, int, int, int, boolean, int)
*/
public MouseWheelEvent (Component source, int id, long when, int modifiers,
int x, int y, int clickCount, boolean popupTrigger,
*** 201,222 ****
this(source, id, when, modifiers, x, y, 0, 0, clickCount,
popupTrigger, scrollType, scrollAmount, wheelRotation);
}
/**
! * Constructs a <code>MouseWheelEvent</code> object with the
* specified source component, type, modifiers, coordinates,
* absolute coordinates, scroll type, scroll amount, and wheel rotation.
! * <p>Note that passing in an invalid <code>id</code> results in
* unspecified behavior. This method throws an
! * <code>IllegalArgumentException</code> if <code>source</code>
! * is <code>null</code>.<p>
* Even if inconsistent values for relative and absolute coordinates are
* passed to the constructor, the MouseWheelEvent instance is still
* created and no exception is thrown.
*
! * @param source the <code>Component</code> that originated
* the event
* @param id the integer that identifies the event
* @param when a long that gives the time the event occurred
* @param modifiers the modifier keys down during event
* (shift, ctrl, alt, meta)
--- 201,222 ----
this(source, id, when, modifiers, x, y, 0, 0, clickCount,
popupTrigger, scrollType, scrollAmount, wheelRotation);
}
/**
! * Constructs a {@code MouseWheelEvent} object with the
* specified source component, type, modifiers, coordinates,
* absolute coordinates, scroll type, scroll amount, and wheel rotation.
! * <p>Note that passing in an invalid {@code id} results in
* unspecified behavior. This method throws an
! * {@code IllegalArgumentException} if {@code source}
! * is {@code null}.<p>
* Even if inconsistent values for relative and absolute coordinates are
* passed to the constructor, the MouseWheelEvent instance is still
* created and no exception is thrown.
*
! * @param source the {@code Component} that originated
* the event
* @param id the integer that identifies the event
* @param when a long that gives the time the event occurred
* @param modifiers the modifier keys down during event
* (shift, ctrl, alt, meta)
*** 227,244 ****
* @param clickCount the number of mouse clicks associated with event
* @param popupTrigger a boolean, true if this event is a trigger for a
* popup-menu
* @param scrollType the type of scrolling which should take place in
* response to this event; valid values are
! * <code>WHEEL_UNIT_SCROLL</code> and
! * <code>WHEEL_BLOCK_SCROLL</code>
! * @param scrollAmount for scrollType <code>WHEEL_UNIT_SCROLL</code>,
* the number of units to be scrolled
* @param wheelRotation the integer number of "clicks" by which the mouse
* wheel was rotated
*
! * @throws IllegalArgumentException if <code>source</code> is null
* @see MouseEvent#MouseEvent(java.awt.Component, int, long, int, int, int, int, boolean)
* @see MouseEvent#MouseEvent(java.awt.Component, int, long, int, int, int, int, int, int, boolean, int)
* @since 1.6
*/
public MouseWheelEvent (Component source, int id, long when, int modifiers,
--- 227,244 ----
* @param clickCount the number of mouse clicks associated with event
* @param popupTrigger a boolean, true if this event is a trigger for a
* popup-menu
* @param scrollType the type of scrolling which should take place in
* response to this event; valid values are
! * {@code WHEEL_UNIT_SCROLL} and
! * {@code WHEEL_BLOCK_SCROLL}
! * @param scrollAmount for scrollType {@code WHEEL_UNIT_SCROLL},
* the number of units to be scrolled
* @param wheelRotation the integer number of "clicks" by which the mouse
* wheel was rotated
*
! * @throws IllegalArgumentException if {@code source} is null
* @see MouseEvent#MouseEvent(java.awt.Component, int, long, int, int, int, int, boolean)
* @see MouseEvent#MouseEvent(java.awt.Component, int, long, int, int, int, int, int, int, boolean, int)
* @since 1.6
*/
public MouseWheelEvent (Component source, int id, long when, int modifiers,
*** 250,298 ****
}
/**
! * Constructs a <code>MouseWheelEvent</code> object with the specified
* source component, type, modifiers, coordinates, absolute coordinates,
* scroll type, scroll amount, and wheel rotation.
! * <p>Note that passing in an invalid <code>id</code> parameter results
* in unspecified behavior. This method throws an
! * <code>IllegalArgumentException</code> if <code>source</code> equals
! * <code>null</code>.
* <p>Even if inconsistent values for relative and absolute coordinates
! * are passed to the constructor, a <code>MouseWheelEvent</code> instance
* is still created and no exception is thrown.
*
! * @param source the <code>Component</code> that originated the event
* @param id the integer value that identifies the event
* @param when a long value that gives the time when the event occurred
* @param modifiers the modifier keys down during event
* (shift, ctrl, alt, meta)
! * @param x the horizontal <code>x</code> coordinate for the
* mouse location
! * @param y the vertical <code>y</code> coordinate for the
* mouse location
! * @param xAbs the absolute horizontal <code>x</code> coordinate for
* the mouse location
! * @param yAbs the absolute vertical <code>y</code> coordinate for
* the mouse location
* @param clickCount the number of mouse clicks associated with the event
! * @param popupTrigger a boolean value, <code>true</code> if this event is a trigger
* for a popup-menu
* @param scrollType the type of scrolling which should take place in
* response to this event; valid values are
! * <code>WHEEL_UNIT_SCROLL</code> and
! * <code>WHEEL_BLOCK_SCROLL</code>
! * @param scrollAmount for scrollType <code>WHEEL_UNIT_SCROLL</code>,
* the number of units to be scrolled
* @param wheelRotation the integer number of "clicks" by which the mouse wheel
* was rotated
* @param preciseWheelRotation the double number of "clicks" by which the mouse wheel
* was rotated
*
! * @throws IllegalArgumentException if <code>source</code> is null
* @see MouseEvent#MouseEvent(java.awt.Component, int, long, int, int, int, int, boolean)
* @see MouseEvent#MouseEvent(java.awt.Component, int, long, int, int, int, int, int, int, boolean, int)
* @since 1.7
*/
public MouseWheelEvent (Component source, int id, long when, int modifiers,
--- 250,298 ----
}
/**
! * Constructs a {@code MouseWheelEvent} object with the specified
* source component, type, modifiers, coordinates, absolute coordinates,
* scroll type, scroll amount, and wheel rotation.
! * <p>Note that passing in an invalid {@code id} parameter results
* in unspecified behavior. This method throws an
! * {@code IllegalArgumentException} if {@code source} equals
! * {@code null}.
* <p>Even if inconsistent values for relative and absolute coordinates
! * are passed to the constructor, a {@code MouseWheelEvent} instance
* is still created and no exception is thrown.
*
! * @param source the {@code Component} that originated the event
* @param id the integer value that identifies the event
* @param when a long value that gives the time when the event occurred
* @param modifiers the modifier keys down during event
* (shift, ctrl, alt, meta)
! * @param x the horizontal {@code x} coordinate for the
* mouse location
! * @param y the vertical {@code y} coordinate for the
* mouse location
! * @param xAbs the absolute horizontal {@code x} coordinate for
* the mouse location
! * @param yAbs the absolute vertical {@code y} coordinate for
* the mouse location
* @param clickCount the number of mouse clicks associated with the event
! * @param popupTrigger a boolean value, {@code true} if this event is a trigger
* for a popup-menu
* @param scrollType the type of scrolling which should take place in
* response to this event; valid values are
! * {@code WHEEL_UNIT_SCROLL} and
! * {@code WHEEL_BLOCK_SCROLL}
! * @param scrollAmount for scrollType {@code WHEEL_UNIT_SCROLL},
* the number of units to be scrolled
* @param wheelRotation the integer number of "clicks" by which the mouse wheel
* was rotated
* @param preciseWheelRotation the double number of "clicks" by which the mouse wheel
* was rotated
*
! * @throws IllegalArgumentException if {@code source} is null
* @see MouseEvent#MouseEvent(java.awt.Component, int, long, int, int, int, int, boolean)
* @see MouseEvent#MouseEvent(java.awt.Component, int, long, int, int, int, int, int, int, boolean, int)
* @since 1.7
*/
public MouseWheelEvent (Component source, int id, long when, int modifiers,
*** 330,345 ****
}
/**
* Returns the number of units that should be scrolled per
* click of mouse wheel rotation.
! * Only valid if <code>getScrollType</code> returns
! * <code>MouseWheelEvent.WHEEL_UNIT_SCROLL</code>
*
* @return number of units to scroll, or an undefined value if
! * <code>getScrollType</code> returns
! * <code>MouseWheelEvent.WHEEL_BLOCK_SCROLL</code>
* @see #getScrollType
*/
public int getScrollAmount() {
return scrollAmount;
}
--- 330,345 ----
}
/**
* Returns the number of units that should be scrolled per
* click of mouse wheel rotation.
! * Only valid if {@code getScrollType} returns
! * {@code MouseWheelEvent.WHEEL_UNIT_SCROLL}
*
* @return number of units to scroll, or an undefined value if
! * {@code getScrollType} returns
! * {@code MouseWheelEvent.WHEEL_BLOCK_SCROLL}
* @see #getScrollType
*/
public int getScrollAmount() {
return scrollAmount;
}
*** 375,390 ****
/**
* 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 <code>ScrollPane</code> and
! * <code>JScrollPane</code> already have this functionality built in.)
* <P>
* This method returns the number of units to scroll when scroll type is
* MouseWheelEvent.WHEEL_UNIT_SCROLL, and should only be called if
! * <code>getScrollType</code> returns MouseWheelEvent.WHEEL_UNIT_SCROLL.
* <P>
* 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
--- 375,390 ----
/**
* 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 {@code ScrollPane} and
! * {@code JScrollPane} already have this functionality built in.)
* <P>
* This method returns the number of units to scroll when scroll type is
* MouseWheelEvent.WHEEL_UNIT_SCROLL, and should only be called if
! * {@code getScrollType} returns MouseWheelEvent.WHEEL_UNIT_SCROLL.
* <P>
* 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
< prev index next >