harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitry Irlyanov (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-4481) [classlib][swing] Slider code is probably uneffective
Date Tue, 17 Jul 2007 08:51:04 GMT
[classlib][swing] Slider code is probably uneffective
-----------------------------------------------------

                 Key: HARMONY-4481
                 URL: https://issues.apache.org/jira/browse/HARMONY-4481
             Project: Harmony
          Issue Type: Improvement
          Components: Classlib
            Reporter: Dmitry Irlyanov
            Priority: Trivial


JSlider code is quite uneffective.

Let's see for example the following function:

protected void calculateTrackBuffer() {
        if (slider.getPaintLabels()) {
            if ((slider.getOrientation() == JSlider.HORIZONTAL)) {
                trackBuffer = getWidthOfHighValueLabel() > getWidthOfLowValueLabel()
                                                ? getWidthOfHighValueLabel() / 2
                                                : getWidthOfLowValueLabel() / 2;
           /**skipped**/
    }

it calls getWidthOfHighValueLabel() twice. getWidthOfHighValueLabel() in it's turn calls getHighestValueLabel()
twice:

protected int getWidthOfHighValueLabel() {
        return getHighestValueLabel() == null ? 0 : getHighestValueLabel().getWidth();
}




Of course, without performance test results it's nothing. But performance test results definitely
won't become worse if my patch have been applied.




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message