|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ks.client.gamefactory.skin.BouncingBalls
Class for presenting a ball bouncing around, and off the various widgets, using the same background color.
While an object is being dragged by the container, no bouncing will occur
Field Summary | |
protected java.util.Vector |
balls
Balls in motion. |
protected Container |
container
Container over which we are operating; we need to have dragging. |
protected java.awt.Rectangle |
containerBounds
Bounds for container -- used to detect off the screen movement. |
protected int |
delay
Delay between bounces. |
protected java.awt.Graphics |
myGraphics
Graphics context in which to draw. |
protected boolean |
onePerChild
Should there just be a single ball, or one per RectangleHierarchy child? |
protected int |
radius
size of ball radius. |
protected java.lang.Thread |
thread
The thread to oversee the scrolling. |
protected boolean |
visible
Assume we are originally visible. |
Constructor Summary | |
BouncingBalls(Container container)
ImageScroller constructor with a single Bouncing Ball. |
|
BouncingBalls(Container container,
boolean onePerChild)
ImageScroller constructor. |
Method Summary | |
int |
getDelay()
Return delay between image scrolling. |
int |
getRadius()
Return size of Ball. |
boolean |
isVisible()
Determine whether image is visible. |
void |
offsetBallPosition()
For each ball in play, update its new position. |
protected int |
randomOffset(int width)
Returns a number from (-width/2) .. |
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 |
setRadius(int newRadius)
Set size of ball. |
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 |
protected java.util.Vector balls
protected int delay
protected boolean onePerChild
protected java.awt.Graphics myGraphics
protected Container container
protected java.awt.Rectangle containerBounds
protected int radius
protected java.lang.Thread thread
protected boolean visible
Constructor Detail |
public BouncingBalls(Container container)
public BouncingBalls(Container container, boolean onePerChild)
Method Detail |
public int getDelay()
public int getRadius()
public boolean isVisible()
public void offsetBallPosition()
protected int randomOffset(int width)
public void run()
run
in interface java.lang.Runnable
public void setDelay(int newDelay)
newDelay
- intpublic void setRadius(int newRadius)
newRadius
- intpublic void setVisible(boolean newVisible)
newVisible
- booleanpublic void visit(RectangleHierarchy node)
public void visit(RectangleHierarchy node, java.awt.Rectangle clip)
Note: only Leaf nodes are drawn.
Clip to the given Rectangle clip area. [clip is unaffected by this invocation.]
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |