-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.3.0
-
x86
-
linux
The following problem occurs with jdk1.3.0 for Linux when using the twm, fvwm and fvwm2 window managers. It does not happen with kde. It also doesn't happen with jdk1.2.2_006
Create and display a java.awt.Window from within a java application and then toggle it's visibility using setVisible(false) and then setVisible(true) after the call to setVisible(true) the Window appears but is Iconified. This also happens if you call show() instead of setVisible(true).
The following code demonstrates the problem. My tests were made with RedHat 6.2
import java.awt.*;
import java.awt.event.*;
public class MyFrame extends Frame implements ActionListener {
Button visible, invisible;
Window testFrame;
public MyFrame() {
setLayout(new FlowLayout());
visible = new Button("Visible");
invisible = new Button("Invisible");
visible.addActionListener(this);
invisible.addActionListener(this);
add(visible);
add(invisible);
}
public void actionPerformed(ActionEvent ae) {
if(ae.getActionCommand().equals("Visible")) {
if(testFrame == null) {
System.out.println("Creating new testFrame");
testFrame = new Window(this);
testFrame.setBounds(100, 100, 100, 100);
testFrame.setVisible(true);
}
else {
testFrame.setVisible(true);
}
}
else if(ae.getActionCommand().equals("Invisible")) {
if(testFrame != null) {
testFrame.setVisible(false);
}
}
}
public static void main(String[] args) {
Frame frame = new MyFrame();
frame.setBounds(0, 0, 100, 60);
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
System.exit(0);
}
});
}
}
Create and display a java.awt.Window from within a java application and then toggle it's visibility using setVisible(false) and then setVisible(true) after the call to setVisible(true) the Window appears but is Iconified. This also happens if you call show() instead of setVisible(true).
The following code demonstrates the problem. My tests were made with RedHat 6.2
import java.awt.*;
import java.awt.event.*;
public class MyFrame extends Frame implements ActionListener {
Button visible, invisible;
Window testFrame;
public MyFrame() {
setLayout(new FlowLayout());
visible = new Button("Visible");
invisible = new Button("Invisible");
visible.addActionListener(this);
invisible.addActionListener(this);
add(visible);
add(invisible);
}
public void actionPerformed(ActionEvent ae) {
if(ae.getActionCommand().equals("Visible")) {
if(testFrame == null) {
System.out.println("Creating new testFrame");
testFrame = new Window(this);
testFrame.setBounds(100, 100, 100, 100);
testFrame.setVisible(true);
}
else {
testFrame.setVisible(true);
}
}
else if(ae.getActionCommand().equals("Invisible")) {
if(testFrame != null) {
testFrame.setVisible(false);
}
}
}
public static void main(String[] args) {
Frame frame = new MyFrame();
frame.setBounds(0, 0, 100, 60);
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
System.exit(0);
}
});
}
}
- duplicates
-
JDK-4392518 Incorrect window (swing) handling with Gnome/enlightenment
- Resolved