Name: jk109818 Date: 05/15/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 :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
JTabbedPane.setOpaque(false) does not behave as it did in
1.3. I filed this as a bug and recieved this in the
response:
This new behavior is part of a fix done for the 1.4
release. Please see the following bug reports for more
information:
http://developer.java.sun.com/developer/bugParade/bugs/4629510.html
AND
http://developer.java.sun.com/developer/bugParade/bugs/4261116.html
Seems like the fix for 4261116 could have been handled
differently. Setting a component to transparent should do
just that. If special behaviour is required in some cases,
other methods could have been added to control these
behaviours...like the border.
Now JTabbedPane seems to violates the opacity rule by
painting a lot of pixels that it should not need to; making
programs that benefitted from the previous behaviour break.
Since I am not the only one concerned about this change, I
am resubmitting this bug as an RFE (it might fit into the
EOU category as well, since getting the 1.3 behaviour is
not intuitive). This way we can see which way other
developers think this should be handled.
In any case, it would be nice if the old functionality
would be available without subclassing the UI.
REGRESSION. Last worked in version 1.3.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See description and sample program
EXPECTED VERSUS ACTUAL BEHAVIOR :
See description and sample program
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class JTabbedPaneTester extends JFrame implements ActionListener {
private JTabbedPane tabbedPane;
private int index = 0;
public JTabbedPaneTester() {
JToolBar tb = new JToolBar();
JButton b = new JButton("Add tab");
b.addActionListener(this);
tb.add(b);
getContentPane().add(tb,BorderLayout.NORTH);
tabbedPane = new JTabbedPane();
JPanel p = new JPanel(new BorderLayout());
p.setOpaque(true);
p.setBackground(Color.white);
p.add(tabbedPane,BorderLayout.CENTER);
getContentPane().add(p,BorderLayout.CENTER);
setSize(500,300);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
show();
}
public void actionPerformed(ActionEvent e) {
JPanel p = new JPanel();
p.setLayout(new BoxLayout(p,BoxLayout.Y_AXIS));
p.setOpaque(false);
index++;
JLabel l = new JLabel("Opaque label on tab " + index);
l.setOpaque(true);
p.add(l);
l = new JLabel("Non opaque label on tab " + index);
l.setOpaque(false);
p.add(l);
tabbedPane.add("Tab " + index,p);
}
public static void main(String[] argv) {
JTabbedPaneTester t = new JTabbedPaneTester();
}
}
---------- END SOURCE ----------
(Review ID: 146561)
======================================================================