你可以將多個MIDIet程序存儲在一個JAR文件中
以下的例子中包含所有你所需要的
源代碼
/*
*
*
* Simple MIDlet
*
import javax
import javax
public class MIDlet
{
private Display display; // Reference to Display object
private TextBox tbxMain; // A Textbox to display a message
private Command cmdExit; // A Command to exit the MIDlet
// The constructor
public MIDlet
{
display = Display
cmdExit = new Command(
tbxMain = new TextBox(
tbxMain
tbxMain
}
// Called by application manager to start the MIDlet
public void startApp()
{
display
}
// A required method
public void pauseApp()
{ }
// A required method
public void destroyApp(boolean unconditional)
{ }
// Check to see if our Exit command was selected
public void commandAction(Command c
{
if (c == cmdExit)
{
destroyApp(false);
notifyDestroyed();
}
}
}
源代碼
/*
*
*
* Simple MIDlet
*
import javax
import javax
public class MIDlet
{
private Display display; // Reference to Display object
private Form frmMain; // The main form
private TextField txfName; // A text field to prompt for name
private Command cmdExit; // A Command to exit the MIDlet
// The constructor
public MIDlet
{
display = Display
cmdExit = new Command(
txfName = new TextField(
frmMain = new Form(
frmMain
frmMain
frmMain
}
// Called by application manager to start the MIDlet
public void startApp()
{
display
}
// A required method
public void pauseApp()
{ }
// A required method
public void destroyApp(boolean unconditional)
{ }
// Check to see if our Exit command was selected
public void commandAction(Command c
{
if (c == cmdExit)
{
destroyApp(false);
notifyDestroyed();
}
}
}
mainfest
MIDlet
MIDlet
MIDlet
MIDlet
MIDlet
MicroEdition
MicroEdition
MIDlet
MIDlet
MIDlet
MIDlet
MIDlet
MIDlet
MIDlet
MIDlet
MIDlet
Emulator的顯示結果
從左向右
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19725.html