|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.microedition.lcdui.Displayable javax.microedition.lcdui.Canvas ch.aplu.gidlet.MConsole
public class MConsole
Full screen text window containing lines of text, simulating Java's
System.out.println.
Each line may have an individual color. No text cursor is shown.
If the number of displayed lines exceeds the height of the display, the
text may be vertically scrolled by using the up/down keys and
horizontally scrolled by using the left/right keys.
Newline character \n may be inserted to start a new line,
other non-printing characters should not be used.
More than one instance may be created. The constructor flag visible
may be used, to select if the display is initially shown or hidden.
A hidden display will become visible by calling show(). There is no other way to
make it hidden than displaying a different display.
print/println may be called while the display is hidden.
A soft button 'Exit' is shown. Hitting the corresponding key will
call the Gidlet's doExit(). If you do not need this button,
invoke removeExitButton().
If you implement your own CommandListener and call setCommandListener(), the internal
CommandListener is disabled.
print() and println() are overloaded for all primitive data types.
main() serves as entry point for the user programm. It is called in the run-method
of a separate thread and should terminate to avoid non-terminated threads.
A global instance of MConsole may be created while declaring application instance variables.
To garantee that the initialization is executed in the Gidlet's thread,
these instances are queued and the intialisation takes place in the same order
they are created when main() is started.
Field Summary |
---|
Fields inherited from class javax.microedition.lcdui.Canvas |
---|
DOWN, FIRE, GAME_A, GAME_B, GAME_C, GAME_D, KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_POUND, KEY_STAR, LEFT, RIGHT, UP |
Constructor Summary | |
---|---|
MConsole()
Contructs a MConsole with unlimited number of lines, black background, white default text color and large size of font. |
|
MConsole(boolean visible)
Contructs a MConsole with unlimited number of lines, black background, white default text color and large size of font. |
|
MConsole(int nbLines,
int bgColor,
int textColor,
int fontSize)
Constructs a MConsole with given maximal number of lines in text buffer, the background color, the default text color and the size of the font (1: small, 2: medium, 3: large) If nbLines <= 0, the number of lines is unlimited. |
|
MConsole(int nbLines,
int bgColor,
int textColor,
int fontSize,
boolean visible)
Constructs a MConsole with given maximal number of lines in text buffer, the background color, the default text color and the size of the font (1: small, 2: medium, 3: large) If nbLines <= 0, the number of lines is unlimited. |
Method Summary | |
---|---|
void |
addOkButton()
Adds an OK soft button with label "OK". |
void |
addOkButton(java.lang.String label)
Adds an OK soft button with given label. |
void |
clear()
Erases all text and show empty console. |
void |
clear(int bgColor,
int textColor)
Erases all text and show empty console and sets background and text colors. |
void |
color(int textColor)
Changes default text color to given color. |
protected void |
init()
Initialize MConsole. |
protected void |
keyPressed(int key)
Notificaton of key pressed. |
protected void |
keyReleased(int key)
Notification of key release. |
protected void |
keyRepeated(int key)
Notification of key repeated. |
protected void |
paint(javax.microedition.lcdui.Graphics g)
Used for rendering canvas. |
void |
print(boolean b)
Prints a boolean. |
void |
print(char ch)
Prints a character. |
void |
print(char[] s)
Prints a array of characters. |
void |
print(double d)
Prints a double-precision floating-point number. |
void |
print(float f)
Prints a floating-point number. |
void |
print(int i)
Prints an integer. |
void |
print(long l)
Prints a long integer. |
void |
print(java.lang.String text)
Appends given text to last line, if print() was previously called or start a new line, if no print-method or println() was previously called. |
void |
println()
Starts a new line. |
void |
println(boolean b)
Prints a boolean and advances on next line. |
void |
println(char ch)
Prints a character and advances on next line. |
void |
println(char[] s)
Prints an array of characters and advances on next line. |
void |
println(double d)
Prints a double-precision floating-point number and advances on next line. |
void |
println(float f)
Prints a floating-point number and advances on next line. |
void |
println(int i)
Prints an integer and advances on next line. |
void |
println(long l)
Prints a long integer and advances on next line. |
void |
println(java.lang.String text)
Appends given text to last line, if print() was previously called or start a new line, if no print-method or println() was previously called. |
void |
removeExitButton()
Removes Exit soft button. |
void |
removeOkButton()
Removes Ok soft button. |
void |
show()
Shows the form display if it is not yet visible or it was previously hidden by another display. |
void |
show(boolean wait)
Shows the console display if it was previously hidden by another display or not yet displayed. |
Methods inherited from class javax.microedition.lcdui.Canvas |
---|
getGameAction, getKeyCode, getKeyName, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, hideNotify, isDoubleBuffered, pointerDragged, pointerPressed, pointerReleased, repaint, repaint, serviceRepaints, setCommandListener, setFullScreenMode, showNotify, sizeChanged |
Methods inherited from class javax.microedition.lcdui.Displayable |
---|
addCommand, getHeight, getTicker, getTitle, getWidth, isShown, removeCommand, setTicker, setTitle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MConsole(int nbLines, int bgColor, int textColor, int fontSize, boolean visible)
public MConsole(int nbLines, int bgColor, int textColor, int fontSize)
public MConsole(boolean visible)
public MConsole()
Method Detail |
---|
public void show()
public void show(boolean wait)
public void color(int textColor)
public void println(java.lang.String text)
public void println()
public void print(java.lang.String text)
public void print(boolean b)
public void print(char ch)
public void print(char[] s)
public void print(double d)
public void print(float f)
public void print(int i)
public void print(long l)
public void println(boolean b)
public void println(char ch)
public void println(char[] s)
public void println(double d)
public void println(float f)
public void println(int i)
public void println(long l)
public void clear()
public void clear(int bgColor, int textColor)
public void addOkButton()
public void addOkButton(java.lang.String label)
public void removeExitButton()
public void removeOkButton()
protected void init()
protected void keyPressed(int key)
keyPressed
in class javax.microedition.lcdui.Canvas
protected void keyRepeated(int key)
keyRepeated
in class javax.microedition.lcdui.Canvas
protected void keyReleased(int key)
keyReleased
in class javax.microedition.lcdui.Canvas
protected void paint(javax.microedition.lcdui.Graphics g)
paint
in class javax.microedition.lcdui.Canvas
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |