TextFieldSystemConstraintsDemo.java
上传用户:gyyuli
上传日期:2013-07-09
资源大小:3050k
文件大小:1k
源码类别:

J2ME

开发平台:

Java

  1. import javax.microedition.midlet.MIDlet;
  2. import javax.microedition.lcdui.*;
  3. public class TextFieldSystemConstraintsDemo extends MIDlet implements CommandListener {
  4.     private Command exitCommand = new Command("Exit", Command.EXIT, 1);
  5.     private Form mainForm;
  6.     public TextFieldSystemConstraintsDemo() {
  7.         mainForm = new Form("TextField演示");
  8.     }
  9.     protected void startApp() {
  10.     mainForm.append(
  11.                     new TextField("密码输入", "", 15, TextField.PASSWORD));
  12.             mainForm.append(
  13.             new TextField("不可改变", "", 15, TextField.UNEDITABLE));
  14.             mainForm.append(
  15.             new TextField("敏感数据", "", 15, TextField.SENSITIVE));
  16.             mainForm.append(
  17.             new TextField("禁止联想", "", 15, TextField.NON_PREDICTIVE));
  18.             mainForm.append(
  19.             new TextField("单词大写", "", 15, TextField.INITIAL_CAPS_WORD));
  20.             mainForm.append(
  21.             new TextField("句子大写", "", 15, TextField.INITIAL_CAPS_SENTENCE));
  22.     mainForm.addCommand(exitCommand);
  23.             mainForm.setCommandListener(this);
  24.             Display.getDisplay(this).setCurrent(mainForm);
  25.     }
  26.     public void commandAction(Command c, Displayable s) {
  27. if (c == exitCommand) {
  28.     destroyApp(false);
  29.     notifyDestroyed();
  30. }
  31.     }
  32.     protected void destroyApp(boolean unconditional) {
  33.     }
  34.     protected void pauseApp() {
  35.     }
  36. }