如何创建一个TextField ..plz帮助我在LWUIT
TextField pin = new TextField ("",TextField.PASSWORD|TextField.URL);
cashpayform.addComponent(pin);
cashpayform.show();
cashpayform.addCommand(exit);
cashpayform.setCommandListener(this);
cashpayform.show();
答案 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的类