-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.0.2, 1.1, 1.1.4, 1.1.5
-
generic, x86, sparc
-
generic, solaris_2.4, windows_95, windows_nt
Name: mc57594 Date: 02/26/97
During the time when something has synchronized on
Component.LOCK, modal dialogs belonging to that hierarchy
will no longer get events, and often will not paint properly
Try the following code, first click the No Lock button,
then the With Lock button. The dialog that pops
up with the With Lock button looks okay, but no events are
comming from the button, so the dialog won't go away and the
application is locked up.
Code follows:
import java.awt.*;
import java.awt.event.*;
class MyDialog extends Dialog implements ActionListener, Runnable {
Button b;
public MyDialog(Frame f) {
super(f,"MyDialog",true);
b = new Button("Me");
b.addActionListener(this);
Label l = new Label("Push 'Me' to exit");
add("Center",l);
add("South",b);
pack();
}
public void actionPerformed(ActionEvent e) {
setVisible(false);
}
}
public class test2 extends Frame implements ActionListener {
Button b1;
Button b2;
public static void main(String argv[]) {
test2 t = new test2();
t.show();
}
public test2() {
b1 = new Button("No lock");
b2 = new Button("With lock");
add("North",b1);
add("South",b2);
b1.addActionListener(this);
b2.addActionListener(this);
}
public void actionPerformed(ActionEvent e) {
MyDialog md;
Object o;
if (e.getSource() == b1) {
//No lock...
md = new MyDialog(this);
md.show();
} else {
//Use lock
o = getTreeLock();
synchronized (o) {
md = new MyDialog(this);
md.show();
}
}
}
}
company - A.I. Soft Inc. , email - ###@###.###
======================================================================
- duplicates
-
JDK-4073042 Modal dialogs can't be used in contexts where Component.LOCK has been acquired
-
- Closed
-
-
JDK-4128106 modal dialog will hang if created within synchronized method
-
- Closed
-