This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Autoscroll of JTextArea
 
Similar Threads
Attaching Scrollbars to Containers
Head First Java Chapter 14 problem
Analogies please.
scrollpane not scrolling
sequence of Head First series - which?