How to speed up JTree TreeCellRenderer ?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Alex_Step
Posted On:   Tuesday, July 31, 2001 09:34 AM

I made a custom cell renderer which extends DefaultTreeCellRenderer,building leaf icons,while comparing if they exist in another directory of files. Now it is going through directory file list and compares each file name and time stamp against each file in some other directory and sets an appropriate leaf icon(equal,less or greater).So it is like double rendering. It works fine with small number of files,for example on the desktop. But when I try to use it on Windows NT network it took 2.5 min to load and then was frozen trying to respond to a mouse click event. What if you have 20 directories 250 files per each - it is a killer... I tried to render only   More>>
			
I made a custom cell renderer which extends DefaultTreeCellRenderer,building leaf icons,while
comparing if they exist in another directory of files.
Now it is going through directory file list and compares each file name and time stamp against each file in
some other directory and sets an appropriate
leaf icon(equal,less or greater).So it is like double rendering.


It works fine with small number of files,for example on the desktop.
But when I try to use it on Windows NT network it took 2.5 min to load and then was frozen trying to respond
to a mouse click event.
What if you have 20 directories 250 files per each - it is a killer...


I tried to render only on expand, but the control goes to MyTreeCellRenderer before it response to mouse click,
that's why you have to click twice on the same
directory to display the correct icons.


TreeCellRenderer repaints cells constantly, which means looping through all nodes when you minimize,maximize
a window - and it is awfully slow... How to turn it off ?


Is there any way to speed up the process or swich the renderer off and on only when you need to ?


May be create another class holding all rendered JTees as a Vector or HashTable and get the right JTree
depending on the node you clicked?


Any help would be appriciated, cause I am stuck here..


Thanks,
Alex

   <<Less
About | Sitemap | Contact