Using LWUIT, I have a Form with two components: a read-only TextArea and a Button:
TextArea text = new TextArea("blah blah blah blah blah blah blah blah blah ...");
text.setEditable(false);
form.addComponent(text);
Button button = new Button("Press Me !");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
// DESIRED CODE IS HERE ...
}
});
form.addComponent(button);
The TextArea has a Scrollbar because it contains a long String, when the user moves DOWN the TextArea's Scrollbar moves down until it reaches the end of the String, then the Button get focused leaving the TextArea's Scrollbar at the end of the TextArea.
I want that, when the Button is clicked, the scrollbar returns back to its original state in the Top of the TextArea instead of being in the Bottom of the TextArea. How could I do this ?