harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r556907 - /harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSliderUI.java
Date Tue, 17 Jul 2007 12:41:20 GMT
Author: apetrenko
Date: Tue Jul 17 05:41:18 2007
New Revision: 556907

URL: http://svn.apache.org/viewvc?view=rev&rev=556907
Log:
Patch for HARMONY-4481 "[classlib][swing] Slider code is probably uneffective"

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSliderUI.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSliderUI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSliderUI.java?view=diff&rev=556907&r1=556906&r2=556907
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSliderUI.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicSliderUI.java
Tue Jul 17 05:41:18 2007
@@ -669,13 +669,17 @@
     protected void calculateTrackBuffer() {
         if (slider.getPaintLabels()) {
             if ((slider.getOrientation() == JSlider.HORIZONTAL)) {
-                trackBuffer = getWidthOfHighValueLabel() > getWidthOfLowValueLabel()
-                                                ? getWidthOfHighValueLabel() / 2
-                                                : getWidthOfLowValueLabel() / 2;
+                int widthOfHighValueLabel = getWidthOfHighValueLabel();
+                int widthOfLowValueLabel = getWidthOfLowValueLabel();
+                trackBuffer = widthOfHighValueLabel > widthOfLowValueLabel 
+                                                ? widthOfHighValueLabel / 2
+                                                : widthOfLowValueLabel / 2;
             } else {
-                trackBuffer = getHeightOfHighValueLabel() > getHeightOfLowValueLabel()
-                                                ? getHeightOfHighValueLabel() / 2
-                                                : getHeightOfLowValueLabel() / 2;
+                int heightOfHighValueLabel = getHeightOfHighValueLabel();
+                int heightOfLowValueLabel = getHeightOfLowValueLabel();
+                trackBuffer = heightOfHighValueLabel > heightOfLowValueLabel
+                                                ? heightOfHighValueLabel / 2
+                                                : heightOfLowValueLabel / 2;
             }
         } else {
             trackBuffer = (slider.getOrientation() == JSlider.HORIZONTAL)
@@ -789,19 +793,27 @@
     }
 
     protected int getWidthOfHighValueLabel() {
-        return getHighestValueLabel() == null ? 0 : getHighestValueLabel().getWidth();
+        Component label = getHighestValueLabel();
+
+        return label == null? 0: label.getWidth();
     }
 
-    protected int getWidthOfLowValueLabel() {
-        return getLowestValueLabel() == null ? 0 : getLowestValueLabel().getWidth();
+    protected int getWidthOfLowValueLabel() {        
+        Component label = getLowestValueLabel();
+
+        return label == null? 0: label.getWidth();
     }
 
     protected int getHeightOfHighValueLabel() {
-        return getHighestValueLabel() == null ? 0 : getHighestValueLabel().getHeight();
+        Component label = getHighestValueLabel();
+
+        return label == null? 0: label.getHeight();
     }
 
-    protected int getHeightOfLowValueLabel() {
-        return getLowestValueLabel() == null ? 0 : getLowestValueLabel().getHeight();
+    protected int getHeightOfLowValueLabel() {        
+        Component label = getLowestValueLabel();
+
+        return label == null? 0: label.getHeight();
     }
 
     protected Component getLowestValueLabel() {



Mime
View raw message