• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using JScrollPane

 
Chuck Lan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i added a JTextArea under JViewport of JScrollPane, and I'm sending text to the JTextArea using the append(String) method. How do I make it so that when the JTextArea is filled with text, that JScrollPane will scroll down automatically as more String is being appended to JTextArea?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is just a guess, but I'd try calling validate() or update() after you append text if it's not happening automatically.
 
Chuck Lan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I called setValue(int) of JScrollBar,and set it to getMaximum() of JScrollBar. That seems to work.
Chuck
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic