LWUIT TextArea problem ~> solved

In MoBaca application, I use LWUIT for UI. I put text area to display each page of the book. But when I display the multi-line text within TextArea, I face the common problem like any other users. When I move the scrollbar to the bottom of the page, the scroll always bring me back to the top of the page. Finally after few try and error, The problem fixed.

We can fix the scrollbar problem by put the TextArea by set layout on the form, I use BorderLayout for the form and and put TextArea inside the form with center properties. I don't know what actually happened, but it was the easiest way to fix my problem (also commonly happened to LWUIT TexfortArea users), since before I have tried by override TextAreaClass. Here is the 2 lines that fix my problem:

TextArea page = new TextArea();
form.addComponent(BorderLayout.CENTER, page);

After I fix the 'auto scrolled-up problem', I got second problem, when I move from one page to next page, the scrollbar should be automatically directed to top of the new page, not stay just like previous possition. For that problem, I just add method to reset the cursor position and refresh the page. And the final result is MoBaca 1.0

0 Responses: