0

I have a LWUIT form1 and form2 ,form1 is displayed with list of titles from Rss File, 1)If the user clicks on any title on fom1,i am able to navigate to form2 ,where i am displaying a text area(Contains Paragraphs of text( Description) from Rss),if suppose the user keep on reading the text and user reached at the end of a line(Cursor remains at the end)(scroll down) on form2. After that user clicks back button on form2,then user able to navigate to form1, 2)Again user clicks on any title on form1,then user should be able to see the text area(he should be able to read the description) from starting but not in the middle or end on form2(Because in Previous case user read all the description till end on form2.

My Problem is: Each time user clicks on any title on form1,i am able to navigate form2,but the cursor should always point to start of my text area(To allow the user start reading the description from statring)But my code is not working

How to reset form values each time it is displayed?

Here my Code:

private void displayCompleteNewsScreen(News detailNews) {
//log.debug("displayCompleteNewsScreen");
form2.removeAll();
form2.repaint();
form2.addCommand(m_backCommand);
form2.addCommandListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {
form1.show();
}
});


Label pubDate = new Label(detailNews.getPubDate().substring(0, 16));
pubDate.getStyle().setFont(Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_SMALL));
form2.addComponent(pubDate);
textarea.setText(detailNews.getDescription());
form2.addComponent(textarea);

form2.show();
}
String
  • 3,660
  • 10
  • 43
  • 66

1 Answers1

1

Try to set the focus to the TextArea everytime you show the Form. You can do that using textArea.requestFocus() after you show the Form.

Mun0n
  • 4,438
  • 4
  • 28
  • 46
  • I've modified my code in the method ,it's not working..... big.setText(detailNews.getDescription()); big.requestFocus(); form2.addComponent(big); – String Oct 10 '12 at 10:13
  • I think,According to the vertical scrollbar,i am able to display my form2 every time,Is there any Form controllers?My Requirement is when i displayed with my form,the Form scroll bar always should be at top? – String Oct 10 '12 at 10:15
  • but the form2 is not a new screen. is in the same form? It can be possible – Mun0n Oct 10 '12 at 10:17
  • I have created my form object in my class constructor – String Oct 10 '12 at 10:18
  • Can you tell me how can it possible? – String Oct 10 '12 at 10:22
  • Yes, but what I want to say is that you can't show 2 forms in the same screen...that is not correct. What you want to show are 2 Containers...right? – Mun0n Oct 10 '12 at 10:22
  • if u check my code in my post,I am just appending one label field and one text area components to the form,on form2 one back button,if we click on it ,it is switching to form1 – String Oct 10 '12 at 10:25
  • if you want you can check this link http://stackoverflow.com/questions/12776448/lwuit-tabs-click-event for further code – String Oct 10 '12 at 10:31