J2SE Version (please include all output from java -version flag):
java version "1.6.0-ea"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-ea-b47)
Java HotSpot(TM) Client VM (build 1.6.0-ea-b47, mixed mode, sharing)
Does this problem occur on J2SE 1.4.x or 5.0.x ? Yes / No (pick one)
Yes
Operating System Configuration Information (be specific):
Microsoft Windows 2000 [Version 5.00.2195]
Hardware Configuration Information (be specific):
Pentium 4
Bug Description:
JFrame is not in front after call to setVisible(true)
With the button getting hidden inside a SplitPane, calling
frame.setVisible(true) followed by hiding the button leaves the wrong
frame in front.
Steps to Reproduce (be specific):
1) Run the code below
2) Press the "Show Second Frame and Hide Button" Button
import java.awt.event.*;
import static javax.swing.JFrame.*;
import static javax.swing.JSplitPane.*;
import javax.swing.*;
public class Test {
public static void main(String[] args) {
final JButton button = new JButton();
button.setAction(new AbstractAction("Show Second Frame and Hide Button") {
public void actionPerformed(ActionEvent anEvent) {
JFrame frame = new JFrame("Second Frame");
frame.setSize(500, 500);
frame.setVisible(true);
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
button.setVisible(false);
}
});
JFrame frame = new JFrame("First Frame");
frame.add(new JSplitPane(HORIZONTAL_SPLIT, new JButton("Do Nothing"), button));
frame.setSize(500, 500);
frame.setVisible(true);
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
}
}