
29-01-2006, 14:28
|
|
|
|
חבר מתאריך: 05.05.04
הודעות: 176
|
|
|
בעיה עם J2ME
אני לומד איך להריץ ישום ג'אווה לפלאפון מהמדריך: http://www.upload.co.il/stage/studi...tion.asp?id=325 .
עכשיו, יש שם תוכנית לדוגמא:
קוד:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class GhostDog extends MIDlet implements CommandListener
{
// Initialize the Midlet Display variable
private Display midletDisplay;
// Initialize a variable for the doneCommand
private Command doneCommand;
public GhostDog ()
{
// Retrieve the display from the static display object
midletDisplay = Display.getDisplay(this);
// Initialize the doneCommand
doneCommand = new Command("DONE", Command.SCREEN, 1);
}
public void startApp()
{
// Create the TextBox containing the "Gh0sT d0g" message
TextBox textBox = new TextBox ("dogg", "Gh0sT d0g", 256, 0);
// Add the done Command to the TextBox
textBox.addCommand(doneCommand);
// Set the command listener for the textbox to the current midlet
textBox.setCommandListener( (CommandListener) this);
// Set the current display of the midlet to the textBox screen
midletDisplay.setCurrent(textBox);
}
public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
}
public void commandAction(Command command, Displayable screen)
{
// If the command is the doneCommand
if (command == doneCommand)
{
// Call the destroyApp method
destroyApp(false);
// Notify the midlet platform that the midlet has completed
notifyDestroyed();
}
}
}
ומשום מה הקוד לא מתקמפל, בטענה:
The GhostDog type moshe must be defined in its own file
מה הוא רוצה ממני?
תודה.
|