org.htmlparser.lexerapplications.thumbelina
Class Sequencer
Thread
org.htmlparser.lexerapplications.thumbelina.Sequencer
public class Sequencer
extends Thread
Display received images at a constant rate.
protected static int | DEFAULT_DELAY - The default delay time, milliseconds.
|
protected boolean | mActive - Activity state.
|
protected int | mDelay - Delay between picture displays.
|
protected ArrayList | mPending - Pictures awaiting display.
|
protected Random | mRandom - Random number generator for picture placement.
|
protected Thumbelina | mThumbelina - The thumbelina object to drive.
|
void | add(Image image, URL url) - Add an image to the pending list.
|
void | add(Image image, 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 Point | random(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.
|
DEFAULT_DELAY
protected static final int DEFAULT_DELAY
The default delay time, milliseconds.
mActive
protected boolean mActive
Activity state.
true
means fetching and displaying, false
not.
mDelay
protected int mDelay
Delay between picture displays.
mPending
protected ArrayList mPending
Pictures awaiting display.
mRandom
protected Random mRandom
Random number generator for picture placement.
mThumbelina
protected Thumbelina mThumbelina
The thumbelina object to drive.
Sequencer
public Sequencer(Thumbelina thumbelina)
Creates a new instance of a Sequencer.
thumbelina
- The object to push images to.
add
public void add(Image image,
URL url)
Add an image to the pending list.
image
- The image to add.url
- The url the image came from.
add
public void add(Image image,
URL url,
boolean background)
Add an image to the panel.
image
- The image to add.url
- The url the image came from.background
- If true
, just add to pending list.
getDelay
public int getDelay()
Getter for property delay.
place
protected void place(Picture picture,
boolean add)
Place a picture in the display area.
Places the picture at a random location on screen.
picture
- The picture to place on screen.add
- If true
, the picture is added to the history.
random
protected Point random(String url,
int width,
int height)
Compute a random point to load the image.
Generate a random point for one of the corners of the image and
then condition the numbers so the image is on screen.
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.
reset
public void reset()
Clears the pending images list.
run
public void run()
Display pictures from pending list with delay between.
If the list is empty it waits on the pending list for new pictures.
setDelay
public void setDelay(int delay)
Setter for property delay.
delay
- New value of property delay.
| © 2005 Derrick Oswald Mai 08, 2008 |
HTML Parser is an open source library released under LGPL. |  |