aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Autoscroll JList 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 JList" Watch "Autoscroll JList" New topic
Author

Autoscroll JList

Dirk Schnelle
Greenhorn

Joined: Jul 07, 2004
Posts: 21
Hi,

I have a JList that I use to display the output of an external process.
The list should always scroll to to the last item.

Since Swing has problems with threads I use a swing timer to be in the AWT event queue and move to the last line.

This seem to work until the process has a lot of output within a short time frame.

The effect is that the list starts flickering, which means that the contents disappears from time to time and then comes back again.

I get no exception.

Any help would be great.

/Dirk
Dirk Schnelle
Greenhorn

Joined: Jul 07, 2004
Posts: 21
I forgot to paste some code:

I init the timer with



the action performed method of list updater looks like this:



Still waiting for help,

dirk
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
Not sure this is what you're after, but worth a look
(just keep clicking the 'add' button)
Dirk Schnelle
Greenhorn

Joined: Jul 07, 2004
Posts: 21
Thanks for the reply.

Yes, I tested i with the method ensureIndexIsVisible.

This was my successless first try. I should have mentioned that.

The problem is, that the model is being filled asynchronously very fast. This way the list (and the scrollpane) may have not been notified throug an AWT event about the new lines. This might also be the reason wqhy it starts flashing, now.

I also tried it with a validate before calling the update without success. It is still possible that the size of the model grows and the list has not processed these events.

/Dirk
 
wood burning stoves
 
subject: Autoscroll JList