Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature may not be available in some browsers.
import javax.microedition.midlet.*;
import javax.microedition.lcdui.* ;
public class WillkommenMIDlet extends MIDlet implements CommandListener
{
private Display display;
TextBox text = null;
private Command commandExit;
public WillkommenMIDlet ()
{
display = Display.getDisplay(this);
text = new TextBox("TextBox","Willkommen", 20, 0);
commandExit = new Command("Exit", Command.SCREEN, 1);
text.addCommand( commandExit);
text.setCommandListener(this);
}
public void startApp()
{
display.setCurrent(text);
}
public void pauseApp()
{
}
public void destroyApp(boolean d)
{
}
public void commandAction(Command c, Displayable d)
{
if ( c == commandExit)
{
destroyApp(false);
notifyDestroyed();
}
}
}
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class HelloMicroWorld extends MIDlet {
private Display display;
private TextCanvas canvas;
public HelloMicroWorld() {
display=Display.getDisplay(this);
canvas=new TextCanvas(this);
}
public void startApp() {
display.setCurrent(canvas);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void exitMIDlet() {
destroyApp(true);
notifyDestroyed();
}
}
class TextCanvas extends Canvas implements CommandListener {
private Command cmExit;
private String text;
private HelloMicroWorld midlet;
public TextCanvas(HelloMicroWorld midlet) {
this.midlet=midlet;
text="Hello Micro-World!";
cmExit=new Command("Exit",Command.EXIT, 1);
addCommand(cmExit);
setCommandListener(this);
}
protected void paint(Graphics g) {
g.setColor(255,255,255);
g.fillRect(0,0,getWidth(),getHeight());
g.setColor(0,0,0);
g.drawString(text,getWidth()/2,getHeight()/2,Graphics.BASELINE|Graphics.HCENTER);
}
public void commandAction(Command c, Displayable d) {
if (c==cmExit)
midlet.exitMIDlet();
}
}