Java by API/javax.microedition.lcdui/TextField

Материал из Java эксперт
Версия от 14:49, 31 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

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) {
  }
}