aspose file tools*
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
Author

Autoscroll of JTextArea

Bredan Tomong
Greenhorn

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?
Thanks,
JTextArea display = new JTextArea(15, 40);
display.setBackground(Color.cyan);
display.setEditable(false);
JScrollPane js = new JScrollPane(display);
js.setAutoscrolls(true);
//display.setAutoscrolls(true);
display.setToolTipText("Messages");
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...
regds.
- satya


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Bredan Tomong
Greenhorn

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.
Thanks,
 
 
subject: Autoscroll of JTextArea
 
Similar Threads
Head First Java Chapter 14 problem
Attaching Scrollbars to Containers
Analogies please.
sequence of Head First series - which?
scrollpane not scrolling