It's not a secret anymore!*
The moose likes Swing / AWT / SWT and the fly likes JScrollPane is scrolled down - how to set it up and let the user scroll is down? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JScrollPane is scrolled down - how to set it up and let the user scroll is down?" Watch "JScrollPane is scrolled down - how to set it up and let the user scroll is down?" New topic
Author

JScrollPane is scrolled down - how to set it up and let the user scroll is down?

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
Hi guys,


I have a simple question:

I have a scrollPane on a JTextArea:

JScrollPane pane = new JScrollPane(ta);
JScrollBar jsb = pane.getVerticalScrollBar();
jsb.setUnitIncrement(100);

when I invoke my frame, the textArea is at the buttom. I mean it is scrolled all the way down.

how can i make sure the textArea will always show the begining of the text (the content on the textarea) and let the user scroll down.

anyone?
thanks
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
In the JTextArea api look down to the section Methods inherited from class javax.swing.text.JTextComponent to find the method setCaretPosition.
 
GeeCON Prague 2014
 
subject: JScrollPane is scrolled down - how to set it up and let the user scroll is down?