changeset 51901:3f5a55b6bad8

8205535: Useless (or buggy) call to Math.round on int input Reviewed-by: jdv
author psadhukhan
date Wed, 25 Jul 2018 15:36:37 +0530
parents 17148c9457a6
children 36bc2044b15c
files src/java.desktop/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java	Thu Jul 19 10:53:38 2018 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicProgressBarUI.java	Wed Jul 25 15:36:37 2018 +0530
@@ -874,7 +874,7 @@
                                                       progressString);
 
         if (progressBar.getOrientation() == JProgressBar.HORIZONTAL) {
-            return new Point(x + Math.round(width/2 - stringWidth/2),
+            return new Point(x + (int)Math.round(width/2.0 - stringWidth/2.0),
                              y + ((height +
                                  fontSizer.getAscent() -
                                  fontSizer.getLeading() -
@@ -882,7 +882,7 @@
         } else { // VERTICAL
             return new Point(x + ((width - fontSizer.getAscent() +
                     fontSizer.getLeading() + fontSizer.getDescent()) / 2),
-                    y + Math.round(height/2 - stringWidth/2));
+                    y + (int)Math.round(height/2.0 - stringWidth/2.0));
         }
     }