-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.4.0, 1.4.1, 1.4.1_02
-
unknown, x86
-
linux, solaris_8, windows_2000
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)
======================================================================
- relates to
-
JDK-4690946 REGRESSION: JTabbedPane.setBackground() and setOpaque() have no effect
- Resolved