y.view
Class Scroller

java.lang.Object
  |
  +--y.view.Scroller
All Implemented Interfaces:
Runnable

public class Scroller
extends Object
implements Runnable

This is a class which scrolls a view in direction with a certain speed. The speed can be changed via a synchronized method. This class is especially usefull when run in a separate thread. A Vector is drawn in the direction of the scrolling.


Constructor Summary
Scroller(Graph2DView view, double xpress, double ypress)
          Constructs a new Scroller for a given view.
 
Method Summary
 void run()
          Loop, in which the scrolling performs
 void setDirection(double x, double y)
          Sets the direction of the scrolling by a direction vector (x,y).
 void stopScroller()
          Stops the thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Scroller

public Scroller(Graph2DView view,
                double xpress,
                double ypress)
Constructs a new Scroller for a given view. The given world coordinates represent an initial reference point for the Scroller.

Method Detail

stopScroller

public void stopScroller()
Stops the thread.


setDirection

public void setDirection(double x,
                         double y)
Sets the direction of the scrolling by a direction vector (x,y). The speed is proportional to the length of this vector.


run

public void run()
Loop, in which the scrolling performs

Specified by:
run in interface Runnable

© Copyright 2000-2003,
yWorks GmbH.
All rights reserved.

2003