JDK-4765304 : JTabbedPane Color incorrect when using SCROLL_TAB_LAYOUT
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0,1.4.1,1.4.1_02
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: linux,solaris_8,windows_2000
  • CPU: unknown,x86
  • Submitted: 2002-10-18
  • Updated: 2003-04-04
  • Resolved: 2003-04-04
Related Reports
Relates :  
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) 
======================================================================

Comments
EVALUATION Yes, this painting should be consistent across the different tab traversal policies. ###@###.### 2002-10-18 Name: omR10226 Date: 03/06/2003 The bug is close related with the bug 4690946. For more detailed evaluation look at the bug 4690946. ###@###.### ====================================================================== The bug isn't reproducible after the fix of 4690946. ###@###.### 2003-04-03
11-06-2004