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

With JSplitPane in VERTICAL_SPLIT, SplitPaneBorder draws bottom edge of divider

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 5.0
    • 1.3.1_06, 1.4.1, 1.4.1_03, 1.4.2
    • client-libs
    • tiger
    • x86
    • linux, windows_2000

    Description



      Name: jk109818 Date: 06/30/2003


      FULL PRODUCT VERSION :
      1.4.1_01, also observable on 1.3.1

      FULL OS VERSION :
      not relevant (bug observed on Linux 2.4.18 and MacOS X 10.1.5)

      A DESCRIPTION OF THE PROBLEM :
      javax.swing.plaf.basic.BasicBorders.SplitPaneBorder is supposed to draw only the outer parts of the border of a JSplitPane, as there exists a separate border class for the divider inside the JSplitPane.

      If the orientation is JSplitPane.HORIZONTAL_SPLIT, the behavior is correct. However, if the orientation of the enclosed JSplitPane is JSplitPane.VERTICAL_SPLIT, the Sun implementation of SplitPaneBorder also paints the bottom (but not the top) edge of the divider.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile and run the enclosed test program.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The edges of the divider should not get painted. See http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/javax/swing/plaf/basic/doc-files/BasicBorders.SplitPaneBorder-2.png?rev=1.2&content-type=text/vnd.viewcvs-markup
      ACTUAL -
      The top edge of the lower part gets painted.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      // BorderTest.java
      //
      // Sorry for this being so messy, but the purpose
      // of this test case is merely to paint a SplitPaneBorder
      // without the divider.

      import java.awt.Color;
      import java.awt.Insets;
      import javax.swing.*;
      import javax.swing.border.*;
      import java.awt.*;
      import javax.swing.plaf.basic.*;

      public class BorderTest {
        public static void main(String[] s)
          throws Exception
        {
          final Color darkShadow = new Color(100,120,200);
          final Color lightShadow = darkShadow.brighter();
          final Color darkHighlight = new Color(200,120,50);
          final Color lightHighlight = darkHighlight.brighter();

          UIManager.setLookAndFeel(new javax.swing.plaf.basic.BasicLookAndFeel()
          {
            public boolean isSupportedLookAndFeel(){ return true; }
            public boolean isNativeLookAndFeel(){ return false; }
            public String getDescription() { return "Foo"; }
            public String getID() { return "FooID"; }
            public String getName() { return "FooName"; }
            public UIDefaults getDefaults()
            {
              UIDefaults s = super.getDefaults();
              s.put("MenuBar.highlight", lightHighlight);
              s.put("MenuBar.shadow", darkShadow);
              return s;
            }
          });

          JFrame f = new JFrame("Foo");
          Box p = Box.createVerticalBox();

          JComponent a = new JPanel();
          a.setBackground(Color.white);
          a.setMinimumSize(new Dimension(10, 10));

          JComponent b = new JPanel();
          b.setBackground(Color.white);
          b.setMinimumSize(new Dimension(10, 10));

          JSplitPane sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, a, b);
          Border bo = new BasicBorders.SplitPaneBorder(lightHighlight,
                                                       Color.red);
          Border ibo = new EmptyBorder(0,0,0,0);
          sp.setBorder(bo);
          sp.setMinimumSize(new Dimension(200, 200));
          JPanel marg = new JPanel(new BorderLayout());

          ((BasicSplitPaneUI) sp.getUI()).getDivider().setBorder(ibo);

          marg.add(sp, BorderLayout.CENTER);
          p.add(marg);

          marg.setBorder(new EmptyBorder(5, 5, 5, 25));
          marg.setBackground(darkShadow);
          p.setBackground(darkShadow);
          f.setBackground(darkShadow);
          System.out.println(bo.getBorderInsets(sp));
          f.getContentPane().add(p);
          f.setVisible(true);
        }
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      Write a custom border and install it on the JSplitPane.
      (Review ID: 188773)
      ======================================================================

      Attachments

        Activity

          People

            apikalev Andrey Pikalev
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: