HelloWorldMidlet.java
/**
* Copyright (c) 2012 Nokia Corporation. All rights reserved.
* Nokia and Nokia Connecting People are registered trademarks of Nokia
Corporation.
* Oracle and Java are trademarks or registered trademarks of Oracle and/or its
* affiliates. Other product and company names mentioned herein may be trademarks
* or trade names of their respective owners.
* See LICENSE.TXT for license information.
*/
package com.nokia.example;
import com.nokia.mid.ui.VirtualKeyboard;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.midlet.MIDlet;
/**
* Simple midlet that displays a static SVG file.
*/
public class HelloWorldMidlet extends MIDlet implements CommandListener {
/**
* Constructor.
*/
public HelloWorldMidlet() {
/**
* VirtualKeyboard is supported from Java Runtime 2.0.0 for Series 40
* onwards. To determine whether a Series 40 device is a full touch
* device and hide the open keypad command from the Options menu.
*/
if (System.getProperty("com.nokia.keyboard.type").equals("None")) {
VirtualKeyboard.hideOpenKeypadCommand(true);
}
// *** create the SVG canvas
svgCanvas = new SvgCanvas1(false);
svgCanvas.setCommandListener(this);
// *** grab a reference to the display
display = Display.getDisplay(this);
display.setCurrent(svgCanvas);
// *** set up the midlet menu
int hotKey = 0;
cmExit = new Command("Exit", Command.BACK, hotKey++);
svgCanvas.addCommand(cmExit);
}
/**
* Required midlet method.
*/
public void startApp() {
}
/**
* Required midlet method.
*/
public void pauseApp() {
}
/**
* Required midlet method.
*/
public void destroyApp(boolean unconditional) {
}
/**
* Handle the various menu actions.
*/
public void commandAction(Command c, Displayable s) {
if (c == cmExit) {
destroyApp(false);
notifyDestroyed();
}
}
/*
* Private members
*/
private Display display;
private SvgCanvas1 svgCanvas;
private Command cmExit;
}