- Download Sun Java Wireless Toolkit 2.3 Beta .
- Run
KToolbar by selecting Start > Programs > Sun Java Wireless Toolkit 2.3 Beta > KToolbar .
- Create a new project, for example, named
TinySuite with a class named TinyMIDlet .
Click on OK after selecting settings for the project “TinySuite.”
Note that this interface is only displayed once for a new project.
The KToolbar will display the following message.
- Create a J2ME source file and put it in the example directory
C:\WTK23\apps\TinySuite\src\ , for example:
C:\WTK23\apps\TinySuite\src\TinyMIDlet.java
|
// This package defines MIDP applications and the interactions
// between the application and the environment in which the
// application runs.
import javax.microedition.midlet.*;
// This package provides a set of features for implementation
// of user interfaces.
import javax.microedition.lcdui.*;
public class TinyMIDlet
extends MIDlet
implements CommandListener {
public void startApp( ) {
Display display = Display.getDisplay( this );
Form mainForm = new Form( "TinyMIDlet" );
mainForm.append( "Welcome to the world of MIDlets!" );
Command exitCommand = new Command( "Exit", Command.EXIT, 0 );
mainForm.addCommand( exitCommand );
mainForm.setCommandListener( this );
display.setCurrent( mainForm );
}
public void pauseApp ( ) { }
public void destroyApp( boolean unconditional ) { }
public void commandAction( Command c, Displayable s ) {
if ( c.getCommandType( ) == Command.EXIT )
notifyDestroyed( );
}
}
|
|
†For how to create Mobile Information Device Profile (MIDP) applications with the J2ME Wireless Toolkit, check J2ME Documentation.
- Build the project by clicking on the
Build button.
The Build includes compilation and preverifying.
- Run the project by clicking on the
Run button.
|
|
Click on Launch ——>
<—— Click on Exit
|
|
|
- Upload the application to handheld devices.
‡To display more than one project on the emulator, specify all the class names.
Modify the KToolbar —> Settings —> MIDlets , for example,
After build and run the projects, the emulaotr will display them as follows:
|