• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

JTree flicker

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 27235
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
What I don't understand is how they changed the earth's orbit to fit the metric calendar. Tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic