RNZN
RNZN

Reputation: 107

LWUIT j2me textfield

how can I create a TextField ..plz help me out in LWUIT

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

Upvotes: 1

Views: 2599

Answers (2)

bharath
bharath

Reputation: 14453

Use this code,

 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();

Upvotes: 4

Nirmal- thInk beYond
Nirmal- thInk beYond

Reputation: 12054

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

make sure that TextField and Form are classes of lwuit

Upvotes: 3

Related Questions