Meaningless Drivel is fun!
The moose likes Swing / AWT / SWT and the fly likes Using JScrollPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Using JScrollPane" Watch "Using JScrollPane" New topic

Using JScrollPane

Chuck Lan

Joined: Feb 17, 2000
Posts: 6
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

Joined: Jan 30, 2000
Posts: 18671
This is just a guess, but I'd try calling validate() or update() after you append text if it's not happening automatically.

"I'm not back." - Bill Harding, Twister
Chuck Lan

Joined: Feb 17, 2000
Posts: 6
I called setValue(int) of JScrollBar,and set it to getMaximum() of JScrollBar. That seems to work.
I agree. Here's the link:
subject: Using JScrollPane
It's not a secret anymore!