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

JTabbedPane Color incorrect when using SCROLL_TAB_LAYOUT

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.4.0, 1.4.1, 1.4.1_02
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • CPU:
      unknown, x86
    • OS:
      linux, solaris_8, windows_2000

      Description



      Name: sv35042 Date: 10/18/2002


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

      FULL OPERATING SYSTEM VERSION :
      Windows 2000 Professional

      A DESCRIPTION OF THE PROBLEM :
      If you set a JTabbedPane to be Opaque(true)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create a JTabbedPane and add a couple JPanels
      2. setOpaque(true)
      3. setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT)
      4. setBackground(Color.red)

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      If you do not use SCROLL_TAB_LAYOUT, the background of the
      JTabbedPane (behind the tabs) turns the red color. If you
      do use it, you get a strange line under the selected tab
      and the background stays the system default color. If you
      shrink the window enough to force the tab arrows to appear,
      the correct background color appears behind the arrows, but
      still not the pane.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      import java.awt.*;

      public class TestFrame extends JFrame {
          JSplitPane jSplitPane1 = new JSplitPane();
          JTabbedPane jTabbedPane2 = new JTabbedPane();
          JPanel jPanel1 = new JPanel();
          JPanel jPanel2 = new JPanel();
          JPanel jPanel4 = new JPanel();
          JPanel jPanel3 = new JPanel();
          JTabbedPane jTabbedPane1 = new JTabbedPane();

          public TestFrame() {
              try {
                  jbInit();
              }
              catch(Exception e) {
                  e.printStackTrace();
              }

          }
          public static void main(String[] args) {
              TestFrame untitled11 = new TestFrame();
              untitled11.setSize(250,250);
              untitled11.show();
          }
          private void jbInit() throws Exception {
              this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
              jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT);
              jTabbedPane1.setBackground(Color.red);
              jTabbedPane1.setOpaque(true);
              jTabbedPane1.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
              jTabbedPane1.add(jPanel3, "Problem");
              jTabbedPane1.add(jPanel4, "Pane");

              jTabbedPane2.setBackground(Color.orange);
              jTabbedPane2.setOpaque(true);
              jTabbedPane2.add(jPanel1, "Working");
              jTabbedPane2.add(jPanel2, "Pane");

              jSplitPane1.add(jTabbedPane1, JSplitPane.TOP);
              jSplitPane1.add(jTabbedPane2, JSplitPane.BOTTOM);
              jSplitPane1.setDividerLocation(100);

              this.getContentPane().add(jSplitPane1, BorderLayout.CENTER);
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :
      None known.
      (Review ID: 158981)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                moasunw Moa Moa (Inactive)
                Reporter:
                svioletsunw Scott Violet (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: