This the code that i did so far.
Code:
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.MIDlet;
public class TextFieldCapture extends MIDlet implements CommandListener {
private Display display;
private Form form = new Form("GUI chat");
private Command send = new Command("Send", Command.SCREEN, 1);
private Command exit = new Command("Exit", Command.EXIT, 1);
private TextField textfield = new TextField("Type Your message:", "", 90, TextField.ANY);
public TextFieldCapture() {
display = Display.getDisplay(this);
form.addCommand(exit);
form.addCommand(send);
form.append(textfield);
form.setCommandListener(this);
}
public void startApp() {
display.setCurrent(form);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command command, Displayable displayable) {
if (command == send) {
textfield.setString("Hello, " + textfield.getString());
form.removeCommand(send);
} else if (command == exit) {
destroyApp(false);
notifyDestroyed();
}
}
}
// TODO Auto-generated method stub
Form form = new Form("Chat GUI");
//command options
TextField textfield =new TextField("TEXT FIELD","",25,TextField.ANY);
form.append(textfield);
display.setCurrent(form);
}
}
But i am stuck here. Any help?
Bookmarks