FULL PRODUCT VERSION :
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-beta-b59)
Java HotSpot(TM) Client VM (build 1.6.0-beta-b65, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
I have an editor which shares a text area between multiple tabs.
The tab which is currently selected contains this text area.
The tabs which are not selected contain an empty JPanel.
When the user selects a different tab, the text area is then moved to that tab. The previously selected tab now contains an empty JPanel.
This worked fine in Tiger and Mantis, but doesn't work with the Mustang snapshots.
When switching between tabs in Mustang, the text area becomes a blank unpainted area. If you highlight the text in the text area, it will part of this blank area.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and execute the code below.
Two tabs should appear. A text area with the text "vanishing screen" should appear in the first tab (tab 1).
Select tab 2.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Tab 2 should become selected and now contain the text area with the text "vanishing screen".
ACTUAL -
Tab 2 is selected, but the text area inside fails to paint. If you highlight the text in the blank area with the mouse, it will repaint partially.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
public class HelloWorld extends JFrame implements ChangeListener
{
JTabbedPane tp = new JTabbedPane();
JTextArea tex = new JTextArea();
public HelloWorld() {
Container cp = getContentPane();
tex.setText("vanishing screen");
tp.addTab("tab1",tex);
tp.addTab("tab2",new JPanel());
tp.addChangeListener(this);
cp.add(tp);
setSize(500,500);
}
public void stateChanged(ChangeEvent ce) {
int pos = tp.getSelectedIndex();
tp.setComponentAt((pos+1)%2,new JPanel());
tp.setComponentAt(pos,tex);
}
public static void main(String args[]) {
new HelloWorld().setVisible(true);
}
}
---------- END SOURCE ----------
Release Regression From : 5.0u6
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.