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

JTree flicker

 
Milesh Dcunha
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a JScrollPane on Which I am adding a JTree. I add data to the JTree dynamically based on the node selected. The data comes from the database. I use the pipeline function of Oracle to get me the data. I show the leaf nodes when they are added to the JTree.

When I click on a node the tree is populated with the data, but there is obvious flicker. When I put a System.out.println() to print something in the populate function the JTree dosen't flicker.

Instead of running the populate function in the main thread, I tried calling function using the SwingUtilities.invokeLater(), but it won't show the data until the JTree has the complete data.

So I again called the function from the main thread. But the flicker is still there.

Maybe I have missed something...but I am not finding a solution.
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what you mean by "flicker". But you have two choices: you can collect the data and not display the JTree until it is completely loaded, or you can display it in various partial stages as you are loading.

You know how to do the first choice, because you described it in your post. So what's different between "flicker" and "displaying of partial results"? Is that not what you are seeing?
 
Milesh Dcunha
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I can see the partial results.
But when the results are added the JTree flickers in the sense that I can see the repaint on the tree happening. Just like what happens when you don't have smooth animation in an applet...hope I am clear on what I mean by flickering.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic