This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Autoscroll JList

 
Dirk Schnelle
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure this is what you're after, but worth a look
(just keep clicking the 'add' button)
 
Dirk Schnelle
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic