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

JSplitPane does not paint transparent controls properly

XMLWordPrintable

    • 1.2.2
    • x86
    • windows_nt



      Name: dbT83986 Date: 01/10/99


      Placing a transparent control in a JSplitPane causes severe painting
      problems. Its probably because the JSpiltPane does not appear to
      clear its own background properly. Try the following test case...

      // Foo.java

      import java.awt.*;
      import javax.swing.*;

      public class Foo extends JFrame {
          
          public static void main(String[] args) {
              (new Foo()).show();
          }
          
          private Foo() {
              super("Painting Test");
              
              JLabel left = new JLabel("Left Component");
              JLabel right = new JLabel("Right Component");
              
              //left.setOpaque(true); // default is false
              //right.setOpaque(true);

              // VERTICAL_SPLIT has the same results
              JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, left, right);
              
              setContentPane(split);
              setSize(400,300);
          }
          
      }

      1 - Compile and run the above program.

      2 - Drag the splitter side-to-side. Notice the painting problems.

      3 - Un-comment the setOpaque(true) lines. Recompile.

      4 - Run the program and perform the same tests. Notice that the
          problem is gone.
      (Review ID: 52344)
      ======================================================================

            svioletsunw Scott Violet (Inactive)
            dblairsunw Dave Blair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: