Search this API

y.view
Class Scroller

java.lang.Object
  extended by y.view.Scroller
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public class Scroller
extends java.lang.Object
implements java.awt.event.ActionListener

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 useful 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 actionPerformed(java.awt.event.ActionEvent actionEvent)
          Loop, in which the scrolling performs
 void dispose()
           
 Drawable getDrawable()
          Returns the Drawable instance that visualizes the scroll mark.
 YVector getScrollDirection()
          Returns the scroll direction as a normalized vector.
 double getScrollSpeedFactor()
          Returns a factor to be applied to scroll speed.
 YPoint getScrollStart()
          Returns the start location of the scroller action.
 void init()
           
 void reinitializeValues(Graph2DView view, double xpress, double ypress)
          Reinitializes the Scroller with the given values.
 void setDirection(double x, double y)
          Sets the direction of the scrolling by a direction vector (x,y).
 void setDrawable(Drawable drawable)
          Sets the Drawable instance that visualizes the scroll mark.
 void setScrollSpeedFactor(double speedFactor)
          Sets a factor to be applied to scroll speed.
 
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

reinitializeValues

public void reinitializeValues(Graph2DView view,
                               double xpress,
                               double ypress)
Reinitializes the Scroller with the given values. A disposed Scroller can only be reused when it has been reinitialized.


setScrollSpeedFactor

public void setScrollSpeedFactor(double speedFactor)
Sets a factor to be applied to scroll speed.


getScrollSpeedFactor

public double getScrollSpeedFactor()
Returns a factor to be applied to scroll speed.


setDrawable

public void setDrawable(Drawable drawable)
Sets the Drawable instance that visualizes the scroll mark. Setting the Drawable to a null value will result in no scroll mark to be shown.


getDrawable

public Drawable getDrawable()
Returns the Drawable instance that visualizes the scroll mark. Setting the Drawable to a null value will result in no scroll mark to be shown.


init

public void init()

dispose

public void dispose()

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.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent actionEvent)
Loop, in which the scrolling performs

Specified by:
actionPerformed in interface java.awt.event.ActionListener

getScrollDirection

public YVector getScrollDirection()
Returns the scroll direction as a normalized vector.


getScrollStart

public YPoint getScrollStart()
Returns the start location of the scroller action. The start location is fixed in view coordinate space. The returned value is measured in world coordinate space, therefore the returned value is bound to vary while the scroller is active.


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