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

SplitPaneBorder has inconsistent appearance

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 6
    • 1.3.1, 1.4.1, 1.4.2
    • client-libs
    • beta
    • x86
    • linux, windows_xp



        Name: jk109818 Date: 09/08/2003


        FULL PRODUCT VERSION :
        1.4.1_01, also observed on 1.3.1

        FULL OS VERSION :
        irrelevant (observed on GNU/Linux 2.4.18 and MacOS X 10.1.5)

        A DESCRIPTION OF THE PROBLEM :
        The bottom left pixel drawn by javax.swing.plaf.basic.SplitPaneBorder has a different color depending on the orientation of the enclosed JSplitPanel. This appearance is visually inconsistent.

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

        2. Look at the pixel of the very bottom left of the two compartment borders. You might want to use a tool that enlarges the screen.

        3. Note its color: orange, the highlight color of the border.

        4. On line 44, replace VERTICAL_SPLIT by HORIZONTAL_SPLIT. Compile and run again.

        5. Look at the pixel again. Note its color.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        The bottom left pixel should always have the same color.
        ACTUAL -
        The bottom left pixel appears in the shadow color if the JSplitPanel orientation is HORIZONTAL_SPLIT, but in the highlight color if it is VERTICAL_SPLIT. See also

        http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/javax/swing/plaf/basic/doc-files/

        and view the files "BasicBorders.SplitPaneBorder-1.png" and "BasicBorders.SplitPaneBorder-2.png" by clicking into the "Rev." column.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        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.black);
            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 implementation.
        (Incident Review ID: 188774)
        ======================================================================

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

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: