uic.themes
Class ScrollWheelHelper

java.lang.Object
  extended byuic.themes.ScrollWheelHelper
All Implemented Interfaces:
EventListener, MouseWheelListener

public class ScrollWheelHelper
extends Object
implements MouseWheelListener

Helper class to allow various themes to use the scrollWheel in a backward compatible manner. ScrollWheel support has been added in Java in release 1.4, so in order to keep our theme backwards compatible we provide an extra class to do the event handling for us and deliver the result as a method call back to us.

The common way to use this is:

      try {
          new ScrollWheelHelper(c, this, "mouseWheelSlot");
      } catch(Throwable t) { }

    public void mouseWheelSlot(int rotation, int units) {

The try catch is used to fail silently when the technology to do scrollwheels is not available. For instance when we use JRE 1.3

Since:
1.1

Constructor Summary
ScrollWheelHelper(Component eventSource, Object targetObject, String targetMethod)
          Create a helper which will call the target on events.
 
Method Summary
 void mouseWheelMoved(MouseWheelEvent mwe)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScrollWheelHelper

public ScrollWheelHelper(Component eventSource,
                         Object targetObject,
                         String targetMethod)
                  throws NoSuchMethodException
Create a helper which will call the target on events.

Parameters:
eventSource - a component where we will call addMouseWheelListener on.
targetObject - the object we will call a method on when an event comes in.
targetMethod - the name of the method to call; notice that we require the metho to be present on the targetObject. The targetMethod should be declared with 2 int arguments.
Throws:
NoSuchMethodException - when the component does not have the addMouseWheelListener, or when the targetObject does not have targetMethod with 2 int arguments.
Method Detail

mouseWheelMoved

public void mouseWheelMoved(MouseWheelEvent mwe)
Specified by:
mouseWheelMoved in interface MouseWheelListener


Copyright © 2002,2003 Thomas Zander Available under the Free Apache licence