- See Also:
- Top Examples, Source Code,
Displayable.setCommandListener(javax.microedition.lcdui.CommandListener)
public void commandAction(Command c,
Displayable d)
- See Also:
SELECT_COMMAND
, addCommand(Command)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[288]"hello world" in the default TextBox
By Anonymous on 2005/06/02 08:36:17 Rate
// "hello world" in the default TextBox
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class HelloMIDlet extends MIDlet
implements CommandListener {
private Command exitCommand;
private Display display;
private TextBox t = null;
public HelloMIDlet ( ) {
display = Display.getDisplay ( this ) ;
exitCommand = new Command ( "Exit", Command.EXIT, 2 ) ;
t = new TextBox ( "Hello MIDlet",
"Test string",
256, 0 ) ;
t.addCommand ( exitCommand ) ;
t.setCommandListener ( this ) ;
}
public void startApp ( ) {
display.setCurrent ( t ) ;
}
public void pauseApp ( ) { }
public void destroyApp ( boolean unconditional ) { }
public void commandAction ( Command c, Displayable s ) {
if ( c == exitCommand ) {
destroyApp ( false ) ;
notifyDestroyed ( ) ;
} } }