|
PenProfile 2.x | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.livescribe.display.Displayable
com.livescribe.display.Canvas
com.livescribe.ext.ui.SlotMachine
public class SlotMachine
This class enables most types of displays that involves N scrolling reels with a number of items in each reel. Each reel can be in a selected or unselected state, with a different image displayed for both.
A reel is like a virtual cylinder, where the last item wraps around to the first (index zero). It can be positioned exactly at an item, or in between two items, by using a floating-point number.

| Constructor Summary | |
|---|---|
SlotMachine()
Creates a new slot machine UI having its drawing offset at zero. |
|
SlotMachine(int startX)
Creates a new slot machine UI having the specified drawing offset. |
|
| Method Summary | |
|---|---|
void |
addReel(Image[] normalImages)
Adds a reel containing the specified images. |
void |
addReel(Image[] unselected,
Image[] selected)
Adds a reel containing the specified unselected and selected images. |
void |
addSeparator(Image separator)
Adds a separator image. |
int |
getReelCount()
Gets the number of reels. |
float |
getReelPosition(int n)
Gets the reel position as a floating-point value. |
void |
moveReel(int n,
float delta)
Moves the reel a specified amount. |
protected void |
paint(Graphics g)
Paints this UI component. |
void |
selectReel(int n,
boolean flag)
Selects the specified reel. |
void |
setReelPosition(int n,
float position)
Sets the location for the specified reel. |
| Methods inherited from class com.livescribe.display.Canvas |
|---|
repaint |
| Methods inherited from class com.livescribe.display.Displayable |
|---|
getSurface, isCurrent, notifyHidden, notifyShown, notifySystemTrayHidden, notifySystemTrayShown |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SlotMachine()
public SlotMachine(int startX)
startX - start offset in pixels from the left side of the canvas| Method Detail |
|---|
public void addReel(Image[] normalImages)
There will be no selected images.
normalImages - the array of unselected imagesaddReel(Image[], Image[])
public void addReel(Image[] unselected,
Image[] selected)
unselected - the array of normal imagesselected - the array of selected images, may be null
NullPointerException - if normal is
null.
IllegalArgumentException - if the selected image array size is
not equal to the normal image array size.public void addSeparator(Image separator)
separator - the separator imagepublic float getReelPosition(int n)
Note that the position will be in the range 0–N, not including N, where N is the reel count.
n - the reel number
IndexOutOfBoundsException - if the reel number is out of range.public int getReelCount()
addReel(Image[], Image[])
public void setReelPosition(int n,
float position)
Note that the position properly wraps around the "cylinder". It is not necessary to worry about keeping track of numbers that are outside of the range 0–N (where N is the reel count.
For example, a position of 2 will show image 2 of reel n.
A position of 2.4 will show the same image, but scrolled up a farther
40% of its height.
n - the reel numberposition - the new position, a floating-point value
IndexOutOfBoundsException - if the reel number is out of range.getReelCount()
public void moveReel(int n,
float delta)
n - the reel numberdelta - move the reel by this amount
IndexOutOfBoundsException - if the reel number is out of range.getReelCount(),
setReelPosition(int, float)
public void selectReel(int n,
boolean flag)
n - the reel numberflag - indicates whether to select the reel
IndexOutOfBoundsException - if the reel number is out of range.getReelCount()protected void paint(Graphics g)
paint in class Displayableg - the graphics context
|
PenProfile 2.x | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||