Bug 24871 - Poor JTree painting performance
Summary: Poor JTree painting performance
Status: RESOLVED FIXED
Alias: None
Product: classpath
Classification: Unclassified
Component: swing (show other bugs)
Version: unspecified
: P3 normal
Target Milestone: 0.20
Assignee: Lillian Angel
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-15 09:33 UTC by Roman Kennke
Modified: 2005-11-16 21:23 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-11-15 14:38:21


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Kennke 2005-11-15 09:33:24 UTC
Hi Lillian,

I notice that the painting performance of JTree breaks down when the tree has a certain size. The reason is that the JTree is painted as a whole, regardless of the current clip setting. This should really be improved because JTree is nearly not usable with bigger trees. This is especially important when used inside a JScrollPane, because when scrolling, usually only a thin line of some pixels must be repainted, the remainder is simply copied by the JViewport painting mechanism.

However, I think in order to achieve this, you need to rework the JTree painting a little. At the moment the painting is performed recursivly, this seems wrong to me. This should really be implemented in a non-recursive way. Then we could do something like this:

int startIndex = tree.getRowForLocation(clip.x, clip.y);
int endIndex = tree.getRowForLocation(clip.x + clip.width, clip.y +clip.height);
int current = startIndex;
while (current <= endIndex)
  // Perform painting....

I think you are most familiar with this area, so I assign the bug to you.
Comment 1 Lillian Angel 2005-11-15 19:35:51 UTC
Fixed. Reimplemented without using recursion.