How to get focus on components in LWUIT form
Hi,
Hope you all will be fine. I created a form with two text areas in it. Now i want when my form is shown, the focus is set on txtArea1, means as form show there is a cursor blinking in the txtArea1 so user can type any thing in it. How can i do it.
here is the code
Code:
//Setup Form 2
form2 = new Form("Form 2");
//set Form layout
form2.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
//Create container that holds component and set its layout
// Container textBoxContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
//create text Area
txtArea1 = new TextArea(2, 5);
txtArea1.setFocusable(true);
txtArea1.setFocus(true);
txtArea1.setGrowByContent(true);
// txtArea1.setText("hi how r u asdsadsadasdasdasdasdasdasdasdasdsadsadsad");
//txtArea1.setFocusable(true);
//adding txtArea1 to container
//textBoxContainer.addComponent(txtArea1 );
//create text Area2
txtArea2 = new TextArea(2, 5);
//adding txtArea1 to container
//textBoxContainer.addComponent(txtArea2 );
//form2.addComponent(0,null,new Label("This is the second Form"));
//form2.addComponent(textBoxContainer);
form2.addCommand(cmdSend);
form2.addCommand(cmdBack);
form2.addCommandListener(this);
form2.addComponent(txtArea1);
form2.addComponent(txtArea2);
form2.setFocusable(true);
form2.setFocused(txtArea1);
Thank you.