Java by API/javax.microedition.lcdui/TextField — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 17:43, 31 мая 2010
TextField.ANY
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.MIDlet;
public class Main extends MIDlet {
protected Display display;
protected void startApp() {
display = Display.getDisplay(this);
Form form = new Form("Item Layout");
form.append("line");
form.append(new TextField("Any", null, 8, TextField.ANY));
display.setCurrent(form);
}
protected void pauseApp() {
}
protected void destroyApp(boolean unconditional) {
}
}
TextField.NUMERIC
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.MIDlet;
public class Main extends MIDlet {
protected Display display;
protected void startApp() {
display = Display.getDisplay(this);
Form form = new Form("Item Layout");
form.append("line");
form.append(new TextField("Number", "12345", 8, TextField.NUMERIC));
display.setCurrent(form);
}
protected void pauseApp() {
}
protected void destroyApp(boolean unconditional) {
}
}
TextField.PASSWORD
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.MIDlet;
public class Main extends MIDlet {
protected Display display;
protected void startApp() {
display = Display.getDisplay(this);
Form form = new Form("Item Layout");
form.append("line");
form.append(new TextField("Password", null, 8, TextField.PASSWORD | TextField.NUMERIC));
display.setCurrent(form);
}
protected void pauseApp() {
}
protected void destroyApp(boolean unconditional) {
}
}
TextField.PHONENUMBER
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.MIDlet;
public class Main extends MIDlet {
protected Display display;
protected void startApp() {
display = Display.getDisplay(this);
Form form = new Form("Item Layout");
form.append("line");
form.append(new TextField("Phone", "1234567890", 10, TextField.PHONENUMBER));
display.setCurrent(form);
}
protected void pauseApp() {
}
protected void destroyApp(boolean unconditional) {
}
}