File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Autoscroll of JTextArea Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Autoscroll of JTextArea" Watch "Autoscroll of JTextArea" New topic

Autoscroll of JTextArea

Bredan Tomong

Joined: Dec 21, 2000
Posts: 13
Hi guys,
Following is a piece of code in my "Connection" program. Sometimes the TextArea - display scrolls automaticly, but sometimes it doesn't.
Can anybody tell me why?
JTextArea display = new JTextArea(15, 40);
JScrollPane js = new JScrollPane(display);
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

because it's auto-scroll thats' why!
(arrr....that was the seinfeld inside me...sorry, couldn't
resist )
On a more serious not, when autoscroll is set the right way,
the scrolls appear when the text content is more than the visible area. if the text content can fit in the visible area, the scrolls don't show-up.
Not sure if this is what you were looking for, maybe I missed your point...
- satya

Take a Minute, Donate an Hour, Change a Life
Bredan Tomong

Joined: Dec 21, 2000
Posts: 13
Jerry Seinfield doesn't know Autoscroll, Elaine knows.
It's not that simple. I thought I wasn't talk about "appear".
Just like a chat room, when you receive a long message, you don't wanna scroll down yourself. In my situation, I have to scroll it down sometimes.
I agree. Here's the link:
subject: Autoscroll of JTextArea
It's not a secret anymore!