On 2/15/10, Todd Volkert <[email protected]> wrote:
> > How can one scroll a text to bottom when it's aligned to top? Could
> > you make some simple example of this behavior in Pivot?
>
> You could call scrollPane.setScrollTop() directly, but it might be easier to
> call textArea.scrollAreaToVisible(x, y, width, height).

Thank you. Calling scrollPane.setScrollTop(n) with a negative n makes the trick.

                TextArea textArea = new TextArea();

                ScrollPane pane = new 
ScrollPane(ScrollBarPolicy.FILL_TO_CAPACITY,
ScrollBarPolicy.FILL_TO_CAPACITY);
                pane.setView(textArea);

                pane.setScrollTop(-500);
                for (int i = 0; i < 100; i++)   {
                        textArea.insertText("gdfg fdgdfg fdgfd");
                        textArea.insertParagraph();
                }

                window = new Window(pane);
                window.setTitle("Test application");
                window.setMaximized(true);
                window.open(display);

However this is not a good solution. Try changing height of the window
or scroll text up and then back down. You may observe many strange
behaviours. For example once you scrolled text up you can't scroll it
down to the same location. Only programmatically.

And these are the most strange:
http://i47.tinypic.com/5aq4hi.png
http://i47.tinypic.com/2w4y25e.png

With all due respect I think the true vertical text alignment is worth
to be implemented in Pivot. I've seen many questions in Google about
the same thing in Swing.

Reply via email to