Name: el35337 Date: 06/12/98
Create two separate JFrames. A modal dialog
appears in front of jframe1. You cannot access
jframe2 because somehow the modal dialog is
associated with jframe2. With this bug, you
cannot really have two separate jframes that
co-exist in one JVM.
I sent this to Java_AWT first, and Jukka Tammisto
told me to report this to swing instead of there.
Source code to make problem below.
import com.sun.java.swing.*;
import java.awt.*;
import java.io.*;
import java.awt.event.*;
public class f extends JFrame
{
public f() {
setSize(getInsets().left + getInsets().right + 400, getInsets().top + getInsets().bottom + 400);
Container c = getContentPane();
c.setLayout(null);
Button b = new Button();
b.setBounds(20, 20, 100, 100);
b.setLabel("Show Dialog");
c.add(b);
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
MyJDialog d = new MyJDialog(f.this);
d.show();
}
});
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
}
public static void main(String[] a)
{
f f1 = new f();
f f2 = new f();
f1.setLocation(0,0);
f2.setLocation(400,0);
f1.show();
f2.show();
}
class MyJDialog extends JDialog
{
JTextField t;
public MyJDialog(JFrame myFrame)
{
super(myFrame, true);
final JFrame frame = myFrame;
setSize(getInsets().left + getInsets().right + 300, getInsets().top + getInsets().bottom + 100);
setLocation(150,400);
}
}
}
(Review ID: 33580)
======================================================================