|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbluegammon.gui.popup.Popup
The Popup
represents a popup with text and zero or many
alternatives that user can select among. A popup can be shown for a
specific amount of time or forever, the latter case requiring a user to close
the popup. The choice of the alternatives can be reported by implementing
a PopupListener
This class contains all functionality of a popup, i.e. interaction, graphics and callback.
Field Summary | |
static char[][] |
ALT_CANCEL
Preset alternative containing CANCEL |
static char[][] |
ALT_OK
Preset alternative containing OK |
static char[][] |
ALT_OK_CANCEL
Preset alternatives containing OK and CANCEL |
static char[][] |
ALT_YES_NO
Preset alternatives containing YES and NO |
static char[][] |
ALT_YES_NO_CANCEL
Preset alternatives containing YES, NO, and CANCEL |
Constructor Summary | |
Popup()
Creates an uninitialized popup. |
Method Summary | |
void |
dispose()
Disposes all resources held by this popup and closes it. |
int |
findNextBreak(char[] text,
int offset,
int len,
int w,
javax.microedition.lcdui.Font f)
Returns next break when breaking a string. |
byte |
getTimeOutChoice()
Returns alternative index on timeout |
void |
init(char[] text,
char[][] altTexts,
byte timeOut,
byte defaultAlt,
byte timeOutAlt,
PopupListener listener,
int width,
int height)
Initializes this popup. |
boolean |
isActive()
Returns whether this popup is active or not. |
void |
keyPressed(int keyCode,
int gameCode)
Handles user interaction when pressing a key. |
void |
paint(javax.microedition.lcdui.Graphics g)
Paints the popup. |
void |
run()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final char[][] ALT_OK
public static final char[][] ALT_CANCEL
public static final char[][] ALT_YES_NO
public static final char[][] ALT_OK_CANCEL
public static final char[][] ALT_YES_NO_CANCEL
Constructor Detail |
public Popup()
init
to setup
this popup instance. This constructor is used for instance cache
functionality.
Method Detail |
public void init(char[] text, char[][] altTexts, byte timeOut, byte defaultAlt, byte timeOutAlt, PopupListener listener, int width, int height)
text
- The text to show in popup.altTexts
- The alternatives to select among or null if no choices.timeOut
- Time out for this popup in seconds (0 means no timeout).defaultAlt
- Index of default alternative.timeOutAlt
- Alternative index reported on time out.listener
- The popuplistener being reported on selection or timeout or null
if no listener.width
- Canvas width.height
- Canvas height.public int findNextBreak(char[] text, int offset, int len, int w, javax.microedition.lcdui.Font f)
text
- The chars to calculate onoffset
- From what offset to read in charslen
- How many characters to readw
- Widthf
- Font
public void paint(javax.microedition.lcdui.Graphics g)
Displayable
's
paint method.
g
- Graphics context to paint on.public void keyPressed(int keyCode, int gameCode)
Displayable
's
keyPressed keyRepeated method.
keyCode
- The keycode.gameCode
- The gamecode.public void dispose()
public boolean isActive()
public byte getTimeOutChoice()
public void run()
run
in interface java.lang.Runnable
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |