• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the JTextArea api look down to the section Methods inherited from class javax.swing.text.JTextComponent to find the method setCaretPosition.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic