src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -320,12 +320,13 @@
     }
 
     private Rectangle getFullChunkBounds(Rectangle box) {
         boolean vertical = (progressBar.getOrientation() == JProgressBar.VERTICAL);
         XPStyle xp = XPStyle.getXP();
-        int gap = xp.getInt(progressBar, Part.PP_PROGRESS, null,
-                            Prop.PROGRESSSPACESIZE, 0);
+        int gap = (xp != null) ? xp.getInt(progressBar, Part.PP_PROGRESS,
+                                           null, Prop.PROGRESSSPACESIZE, 0)
+                               : 0;
 
         if (!vertical) {
             int chunksize = box.width+gap;
             return new Rectangle(box.x-chunksize*2, box.y, chunksize*3, box.height);
         } else {

@@ -336,10 +337,13 @@
 
     private void paintIndeterminateFrame(Rectangle box, Graphics2D g,
                                           boolean vertical,
                                           int bgwidth, int bgheight) {
         XPStyle xp = XPStyle.getXP();
+        if (xp == null) {
+            return;
+        }
 
         // create a new graphics to keep drawing surface state
         Graphics2D gfx = (Graphics2D)g.create();
 
         Part part = vertical ? Part.PP_BARVERT : Part.PP_BAR;

@@ -394,10 +398,13 @@
     }
 
     private void paintXPBackground(Graphics g, boolean vertical,
                                    int barRectWidth, int barRectHeight) {
         XPStyle xp = XPStyle.getXP();
+        if (xp == null) {
+            return;
+        }
         Part part = vertical ? Part.PP_BARVERT : Part.PP_BAR;
         Skin skin = xp.getSkin(progressBar, part);
 
         // Paint background
         skin.paintSkin(g, 0, 0, barRectWidth, barRectHeight, null);