Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6837913

Nimbus LAF: JProgressBar painting glitches for values <= 6%

XMLWordPrintable

      FULL PRODUCT VERSION :
      1.6.0_13-b03 (Windows test case)
      1.6.0_13-b03 (Linux test case)

      ADDITIONAL OS VERSION INFORMATION :
      Linux xxxxxxx 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:58:03 UTC 2009 x86_64 GNU/Linux
      Microsoft Windows Server 2003 Service Pack 2

      A DESCRIPTION OF THE PROBLEM :
      When running under the Nimbus look and feel, JProgressBar paints the orange progress bar a couple of pixels outside/to the left of its painted background, for progress values <= 6.

      The problem is reproducible on both Linux (Ubuntu 9.04, Java 6 update 13) and Windows (Server 2003 Java 6 update 13).

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      The attached test case reproduces the problem always. Increment the JSpinner and see that the progress bar displays the glitch when value <= 6.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The progress bar should be painted inside its background for all values.
      ACTUAL -
      The progress bar is pained outside its background for values <= 6.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
          public static void main(String[] args) throws Exception {
              SwingUtilities.invokeAndWait(new Runnable() {
                  public void run() {
                      try {
                          UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
                          JFrame frame = new JFrame("JProgressBar Nimbus TestCase");
                          frame.setLayout(new FlowLayout());
                          final JProgressBar bar = new JProgressBar();
                          final JSpinner spinner = new JSpinner(new SpinnerNumberModel(0, 0, 100, 1));
                          spinner.addChangeListener(new ChangeListener() {
                              public void stateChanged(ChangeEvent e) {
                                  bar.setValue((Integer)spinner.getValue());
                              }
                          });
                          frame.add(bar);
                          frame.add(spinner);
                          frame.pack();
                          frame.setLocationRelativeTo(null);
                          frame.setVisible(true);
                          frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
                      }
                      catch (Exception e) {
                          throw new RuntimeException(e);
                      }
                  }
              });
          }
      ---------- END SOURCE ----------

            ssadetsky Semyon Sadetsky (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: