LWUIT j2me textfield

时间:2011-07-07 08:32:04

标签: java java-me textfield lwuit

如何创建一个TextField ..plz帮助我在LWUIT

TextField pin = new TextField ("",TextField.PASSWORD|TextField.URL);
cashpayform.addComponent(pin);
cashpayform.show();
 cashpayform.addCommand(exit);
        cashpayform.setCommandListener(this);
 cashpayform.show();

2 个答案:

答案 0 :(得分:4)

使用此代码,

 Form form = new Form("Sample");
 form.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
 TextField textField = new TextField();
 textField.setConstraint(TextField.PASSWORD | TextField.URL);
 textField.setMaxSize(100);
 form.addComponent(textField);
 form.addCommand(new Command("Exit") {

     public void actionPerformed(ActionEvent evt) {
         notifyDestroyed();
     }
 });
 form.show();

答案 1 :(得分:3)

TextField tf = new TextField();
tf.setConstraint(TextArea.PASSWORD | TextArea.URL);

确保TextField和Form是lwuit的类