ks.client.gamefactory.skin
Class ImageScroller

java.lang.Object
  |
  +--ks.client.gamefactory.skin.ImageScroller
All Implemented Interfaces:
java.lang.Runnable

public class ImageScroller
extends java.lang.Object
implements java.lang.Runnable

Class for presenting a scrolling image on the back of a solitaire game.

While an object is being dragged by the container, no scrolling will occur

This could be made more generic (to allow scrolling up/down/left/right/random)...

Creation date: (10/11/01 5:00:49 PM)


Field Summary
protected  Container container
          Container over which we are operating; we need to have dragging.
protected  int delay
          Delay between scrolling.
protected  int edge
          The distance between the left edge and position of leading scrolled edge.
protected  java.awt.Image myImage
          Image being scrolled.
protected  int scrollDistance
          Distance to scroll horizontally with each clock tick.
protected  java.lang.Thread thread
          The thread to oversee the scrolling.
protected  boolean visible
          Assume we are originally visible.
 
Constructor Summary
ImageScroller(java.awt.Image img, Container container)
          ImageScroller constructor.
 
Method Summary
 int getDelay()
          Return delay between image scrolling.
 int getScrollDistance()
          Return distance to scroll image.
 boolean isVisible()
          Determine whether image is visible.
 void run()
          Thread will operate by pausing n milliseconds and then checking if container is in a drag.
 void setDelay(int newDelay)
          Set the time delay between image scrolling.
 void setScrollDistance(int newScrollDistance)
          Set the distance to scroll each time.
 void setVisible(boolean newVisible)
          Setting to invisible will cause this thread to stop.
 void visit(RectangleHierarchy node)
          Copy the appropriate image onto Graphics g at (x,y,width,height) taking into account the scrolling image.
 void visit(RectangleHierarchy node, java.awt.Rectangle clip)
          Copy the appropriate image onto Graphics g at (x,y,width,height) taking into account the scrolling image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myImage

protected java.awt.Image myImage
Image being scrolled.


delay

protected int delay
Delay between scrolling.


container

protected Container container
Container over which we are operating; we need to have dragging.


edge

protected int edge
The distance between the left edge and position of leading scrolled edge.


scrollDistance

protected int scrollDistance
Distance to scroll horizontally with each clock tick.


thread

protected java.lang.Thread thread
The thread to oversee the scrolling.


visible

protected boolean visible
Assume we are originally visible.

Constructor Detail

ImageScroller

public ImageScroller(java.awt.Image img,
                     Container container)
ImageScroller constructor.

Method Detail

getDelay

public int getDelay()
Return delay between image scrolling.

Returns:
int

getScrollDistance

public int getScrollDistance()
Return distance to scroll image.

Returns:
int

isVisible

public boolean isVisible()
Determine whether image is visible.

Returns:
boolean

run

public void run()
Thread will operate by pausing n milliseconds and then checking if container is in a drag. Once it is verified that we can scroll, we do so, and the entire container background is redrawn.

Specified by:
run in interface java.lang.Runnable

setDelay

public void setDelay(int newDelay)
Set the time delay between image scrolling.

Parameters:
newDelay - int

setScrollDistance

public void setScrollDistance(int newScrollDistance)
Set the distance to scroll each time.

Parameters:
newScrollDistance - int

setVisible

public void setVisible(boolean newVisible)
Setting to invisible will cause this thread to stop.

Parameters:
newVisible - boolean

visit

public void visit(RectangleHierarchy node)
Copy the appropriate image onto Graphics g at (x,y,width,height) taking into account the scrolling image.


visit

public void visit(RectangleHierarchy node,
                  java.awt.Rectangle clip)
Copy the appropriate image onto Graphics g at (x,y,width,height) taking into account the scrolling image.

Note: only Leaf nodes are drawn.

Note: In V2.1 fixed defect in missing clip argument to recursive calls!

Clip to the given Rectangle clip area. [clip is unaffected by this invocation.]