public class Sequencer
extends java.lang.Thread
Modifier and Type | Field and Description |
---|---|
protected static int |
DEFAULT_DELAY
The default delay time, 500 milliseconds.
|
protected boolean |
mActive
Activity state.
|
protected int |
mDelay
Delay between picture displays.
|
protected java.util.ArrayList |
mPending
Pictures awaiting display.
|
protected java.util.Random |
mRandom
Random number generator for picture placement.
|
protected Thumbelina |
mThumbelina
The thumbelina object to drive.
|
Constructor and Description |
---|
Sequencer(Thumbelina thumbelina)
Creates a new instance of a Sequencer.
|
Modifier and Type | Method and Description |
---|---|
void |
add(java.awt.Image image,
java.net.URL url)
Add an image to the pending list.
|
void |
add(java.awt.Image image,
java.net.URL url,
boolean background)
Add an image to the panel.
|
int |
getDelay()
Getter for property delay.
|
protected void |
place(Picture picture,
boolean add)
Place a picture in the display area.
|
protected java.awt.Point |
random(java.lang.String url,
int width,
int height)
Compute a random point to load the image.
|
void |
reset()
Clears the pending images list.
|
void |
run()
Display pictures from pending list with delay between.
|
void |
setDelay(int delay)
Setter for property delay.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
protected static final int DEFAULT_DELAY
protected Thumbelina mThumbelina
protected java.util.ArrayList mPending
protected boolean mActive
true
means fetching and displaying, false
not.protected int mDelay
protected java.util.Random mRandom
public Sequencer(Thumbelina thumbelina)
thumbelina
- The object to push images to.public void reset()
protected java.awt.Point random(java.lang.String url, int width, int height)
url
- The url this picture was fetched from.
Used in computing the random position, so the picture is always
placed in the same location, even when refetched.width
- The width of the image.height
- The height of the image.public void add(java.awt.Image image, java.net.URL url)
image
- The image to add.url
- The url the image came from.public void add(java.awt.Image image, java.net.URL url, boolean background)
image
- The image to add.url
- The url the image came from.background
- If true
, just add to pending list.protected void place(Picture picture, boolean add)
picture
- The picture to place on screen.add
- If true
, the picture is added to the history.public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public int getDelay()
public void setDelay(int delay)
delay
- New value of property delay.HTML Parser is an open source library released under LGPL.