|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.microedition.lcdui.Displayable
javax.microedition.lcdui.Screen
javax.microedition.lcdui.Form
com.nokia.midp.examples.lcdui.helloworldplus.TextEditor
The TextEditor class allows the user to edit the message displayed.
This class extends the Form class and uses an instance of TextField to provide an editable text field.
The initial text message can set via the constructor or via setText() method.
| Field Summary | |
private static javax.microedition.lcdui.Command |
CMD_CANCEL
Command specified to dismiss the TextEditor form and reject the edited text. |
private static javax.microedition.lcdui.Command |
CMD_OK
Command specified to dismiss the TextEditor form and accept the edited text. |
private static int |
COMMAND_PRIORITY
Priority of commands relative to others of the same type. |
private static int |
MAX_TEXT_SIZE
The maximum size of the text allowed in the text field. |
private HelloWorldPlusMIDlet |
midlet
Back reference to parent MIDlet class enabling this class to access to access the callback methods provided by HelloWorldMIDlet. |
private javax.microedition.lcdui.TextField |
textField
Reference to the instance of the TextField class created and appended to the form. |
| Fields inherited from class javax.microedition.lcdui.Form |
|
| Fields inherited from class javax.microedition.lcdui.Displayable |
|
| Constructor Summary | |
(package private) |
TextEditor(HelloWorldPlusMIDlet midlet,
java.lang.String message)
The constructor initializes the class making it ready for use. |
| Method Summary | |
void |
commandAction(javax.microedition.lcdui.Command cmd,
javax.microedition.lcdui.Displayable source)
Handles commands received. |
void |
setText(java.lang.String message)
Sets the opening text in the textfield. |
| Methods inherited from class javax.microedition.lcdui.Form |
append, append, append, delete, deleteAll, get, getHeight, getWidth, insert, set, setItemStateListener, size |
| Methods inherited from class javax.microedition.lcdui.Displayable |
addCommand, getTicker, getTitle, isShown, removeCommand, setCommandListener, setTicker, setTitle, sizeChanged |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private javax.microedition.lcdui.TextField textField
private final HelloWorldPlusMIDlet midlet
private static final int COMMAND_PRIORITY
private static final javax.microedition.lcdui.Command CMD_OK
private static final javax.microedition.lcdui.Command CMD_CANCEL
private static final int MAX_TEXT_SIZE
| Constructor Detail |
TextEditor(HelloWorldPlusMIDlet midlet,
java.lang.String message)
It initializes the reference to the parent MIDlet class with the paramater
value 'midlet'.
It creates an instance of TextField initialized with the parameter 'message'.
It appends the created instance of TextField to the form.
It adds the Command objects defined to the command handling framework.
It calls setCommandListener() to register itself with the command framework
as the command listener and will be notified when a command is activated.
midlet - is a reference to the parent MIDlet. Enables callback to parent object.message - sets the opening text in the text field.| Method Detail |
public void commandAction(javax.microedition.lcdui.Command cmd,
javax.microedition.lcdui.Displayable source)
The CMD_OK command instructs the MIDlet to dismiss the form and accept the edited text. The method handles this command by calling the parent method textEditorDone() passing an initialised instance of String.
The CMD_CANCEL command instructs the MIDlet to dismiss the form and reject the edited text. The method handles this command by calling the parent method textEditorDone() passing an uninitialised reference.
commandAction in interface javax.microedition.lcdui.CommandListenercmd - is the identity of command received from the framework.source - is the identity of the UI area displayed which generated the
command.public void setText(java.lang.String message)
message - is the opening text to be displayed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||