Extension SDK

oracle.ide.util
Interface MouseWheelScrollable


public interface MouseWheelScrollable

This class allows a Component to be scrolled with the wheelmouse even if it is not a JScrollPane. To get mousewheel event, the component you want to be scrollable must implement this interface.

See Also:
MWheelHandler

Method Summary
 int mouseWheelMoved(int nScrolledBy, int x, int y, int nKeyMask)
          Invoked by the MWheelHandler when the wheelmouse is scrolled over a component.
 

Method Detail

mouseWheelMoved

public int mouseWheelMoved(int nScrolledBy,
                           int x,
                           int y,
                           int nKeyMask)
Invoked by the MWheelHandler when the wheelmouse is scrolled over a component.

Scrolling amounts are specified in multiple of WHEEL_DELTA and one WHEEL_DELTA represents a user configurable number of lines to scroll. The number of lines to scroll can be given by MWheelHandler.getWheelScrollLines().

The current models of wheel mouse always scroll by increments of MWheelHandler.WHEEL_DELTA but this is not guaranteed to be true in the future. If a new model of wheelmouse scrolls by a lower amount and we only scroll by nScrolledBy/WHEEL_DELTA the scroll would never happen. For example, if the mouse scrolls by 60 in place of 120, 60/120 = 0 and we would always scroll by 0. For this reason, we must keep the reminder of the division and add it to the next scroll amount. The reminder will already be added to nScrolledBy but it is your responsability to return the reminder.

Parameters:
nScrolledBy - The amount to scroll.
x - The horizontal position of the mouse in local coordinates
y - The vertical position of the mouse in local coordinates
nKeyMask - indicates if the Shift or Alt key is down. Takes values from InputEvent.SHIFT_MASK and CTRL_MASK.
Returns:
The reminder I explained above.

Extension SDK

 

Copyright ©1997, 2003, Oracle. All rights reserved.