jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java
changeset 33856 875f59862274
parent 25859 3317bb8137f4
child 37698 4d798c873df0
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java	Wed Oct 28 16:42:49 2015 +0300
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java	Thu Oct 29 18:43:21 2015 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,6 +49,8 @@
     private boolean paintOutsideClip;
     private boolean tileWhenIndeterminate; //whether to tile indeterminate painting
     private int tileWidth; //the width of each tile
+    private Dimension minBarSize; // minimal visible bar size
+    private int glowWidth; // Glow around the bar foreground
 
     /**
      * Creates a new UI object for the given component.
@@ -114,6 +116,8 @@
                 tileWidth *= 0.784;
             }
         }
+        minBarSize = (Dimension)style.get(context, "ProgressBar.minBarSize");
+        glowWidth = style.getInt(context, "ProgressBar.glowWidth", 0);
         context.dispose();
     }
 
@@ -258,7 +262,7 @@
 
                     if (!SynthLookAndFeel.isLeftToRight(pBar)) {
                         x = pBar.getWidth() - pBarInsets.right - width
-                                - progressPadding;
+                                - progressPadding - glowWidth;
                     }
                 } else {  // JProgressBar.VERTICAL
                     x = pBarInsets.left + progressPadding;
@@ -271,9 +275,9 @@
                     y = pBar.getHeight() - pBarInsets.bottom - height
                             - progressPadding;
 
-                    // When the progress bar is vertical we always paint
-                    // from bottom to top, not matter what the component
-                    // orientation is.
+                    if (SynthLookAndFeel.isLeftToRight(pBar)) {
+                        y -= glowWidth;
+                    }
                 }
             }
         } else {
@@ -307,8 +311,11 @@
             }
             g.setClip(clip);
         } else {
-            context.getPainter().paintProgressBarForeground(context, g,
-                    x, y, width, height, pBar.getOrientation());
+            if (minBarSize == null || (width >= minBarSize.width
+                    && height >= minBarSize.height)) {
+                context.getPainter().paintProgressBarForeground(context, g,
+                        x, y, width, height, pBar.getOrientation());
+            }
         }
 
         if (pBar.isStringPainted()) {