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

1.4 REGRESSION: Box doesn't paint background as content pane

XMLWordPrintable



      Name: jk109818 Date: 09/17/2003


      FULL PRODUCT VERSION :
      java version "1.4.1_02"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
      Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)

      java version "1.4.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
      Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)

      java version "1.3.1_07"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_07-b02)
      Java HotSpot(TM) Client VM (build 1.3.1_07-b02, mixed mode)


      FULL OS VERSION :
      Linux indigo 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386 GNU/Linux


      A DESCRIPTION OF THE PROBLEM :
      Boxes seem to have some repaint problems when there's not a "heavy" (descended from JComponent) Swing component behind them. On Linux in the 1.4.x series, a Box as content pane fails to paint its background, resulting in random noise artifacts in the final rendering. I have also observed a similar bug (which I'm in the process of pursueing) where a Box as the target of a ScrollPane gets painted solid white (instead of striped) when running on Mac OS X.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Seems to have been broken in the transition from 1.3.x to 1.4.x, as it works with 1.3.1_07 but not with 1.4.0_01 and later.

      Run the code below on a Linux box. Play with resizing the frame to see that the background on the right-hand side is never repainted.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import javax.swing.*;
      /**
      * <code>BoxVsPanel</code> demonstrates a Box-rendering
      * bug on Java 1.4.1.
      *
      * <p>Copyright (C) 2003 by Ian W. Davis. All rights reserved.
      * <br>Begun on Tue Jun 10 08:51:17 EDT 2003
      */
      public class BoxVsPanel //extends ... implements ...
      {
          public void Main()
          {
              JPanel panel = new JPanel(new GridLayout(0,1));
              Box box = Box.createVerticalBox();
              
              fillContainer(panel);
              fillContainer(box);
              
              Box cp = Box.createHorizontalBox();
              cp.add(panel);
              cp.add(box);
              
              JFrame frame = new JFrame("BoxVsPanel2");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setContentPane(cp);
              frame.pack();
              frame.setSize(frame.getWidth()+100, frame.getHeight()+100);
              frame.setVisible(true);
          }
          
          void fillContainer(Container c)
          {
              c.add(new JCheckBox("[Dum dum dum] A loooong time ago in a"));
              c.add(new JCheckBox("galaxy"));
              c.add(new JCheckBox("far, far away..."));
          }

          public static void main(String[] args)
          {
              BoxVsPanel mainprog = new BoxVsPanel();
              mainprog.Main();
          }
      }//class

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Boxes can be wrapped in JPanels to provide a solid background behind them.

      Release Regression From : 1.3.1_07
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

      (Incident Review ID: 187522)
      ======================================================================

            svioletsunw Scott Violet (Inactive)
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: