JDK-4261116 : Transparent JTabbedPane doesn't fill in content area
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.2
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 1999-08-09
  • Updated: 2000-03-22
  • Resolved: 2000-03-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.0 betaFixed
Related Reports
Relates :  
Relates :  
Description

Name: rlT66838			Date: 08/09/99


I'd like to make my JTabbedPane transparent, so the background shows up in the area around the tabs (e.g. the area to the right of the tabs, when the tabs are in the upper-left corner). But when I do this, the tabbed pane's content area becomes transparent too. This is not the right thing - it breaks the abstraction that this is an actual panel that other things can be placed on. It now looks like it's got a hole in the middle. What's more, if I try to get rid of the hole by placing an opaque JPanel on each tab pane, there's a ring of transparency around each of my JPanels. This seems to be a no-man's land which is not painted either by the JTabbedPane or its contents. 

import javax.swing.*;
import java.awt.*;

public class TabTest2 
{
	public final static void main (String[] args)
	{
		// Create frame
		JFrame f = new JFrame("hi");
		f.setBounds(100,100,400,400);
		JPanel p = new JPanel();
		p.setBackground(Color.red);
		p.setLayout(null);
		f.getContentPane().add(p);

		// Create tab pane
		JTabbedPane t = new JTabbedPane();
		t.setBounds(50, 50, 300, 200);
		JLabel x = new JLabel("transparent");
		x.setOpaque(false);
		t.addTab("transparent", x);
		JLabel y = new JLabel("opaque");
		y.setOpaque(true);
		t.addTab("opaque", y);
		p.add(t);

		// Show the frame.
		f.show();
	}
}
(Review ID: 93708) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: merlin-beta FIXED IN: merlin-beta INTEGRATED IN: merlin-beta
14-06-2004

EVALUATION Yes, it does seem like we should fill in the area defined for the content. We'll change the paint code to fill in the region behind the content area using the tabbedpane's background color. amy.fowler@Eng 2000-03-16
16-03-2000