Skip to content

Instantly share code, notes, and snippets.


mkmozgawa/ Secret

Created Oct 8, 2020
What would you like to do?
A simple J2ME app
package hello;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class HelloWorld extends MIDlet implements CommandListener {
private Display display;
private TextField field;
private String name;
private TextField greeting;
private Command writeName;
private Form form;
public HelloWorld() {
form = new Form("My first form");
field = new TextField("Tell me your name: ", "", 30, TextField.ANY);
greeting = new TextField("", "Hello, person!", 30, TextField.UNEDITABLE);
writeName = new Command("What's my name?", Command.OK, 0);
display = Display.getDisplay(this);
public void startApp() {
public void pauseApp() {
public void destroyApp(boolean unconditional) {
public void commandAction(Command c, Displayable s) {
if (c.getCommandType() == Command.OK) {
name = field.getString();
private void writeName(String name) {
greeting.setString("Hello, " + name + "!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.