-
Bug
-
Resolution: Fixed
-
P4
-
1.1.3, 1.2.2
-
005
-
x86, sparc
-
solaris_2.5.1, windows_nt
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2017583 | 1.4.0 | Tao Ma | P4 | Resolved | Fixed | beta2 |
JDK-2017582 | 1.3.1 | Tao Ma | P4 | Resolved | Fixed | 1.3.1 |
JDK-2017581 | 1.3.0_02 | Tao Ma | P4 | Closed | Fixed | 02 |
Name: joT67522 Date: 10/27/97
/*
* java.awt.Dialog blocking bug
* Jason Mathews
* Fri, Oct 24, 06:11:17 PM
*
* Problem: Modal dialogs do not block fast enough allowing for multiple
* modal dialog instances to be created before the block is enabled.
*
* Clicking on the "Create Modal Dialog..." button on applet/frame several
* times in rapid succession brings up multiple dialog windows. It appears
* that there's a race condition of whether the first modal dialog
* invokes the modal block or the subsequent Button events are processed by
* the applet's event handler. The create dialog button event is handled
* before the first modal dialog instance invokes the modal block, hence
* multiple dialogs are created when you only want one.
*
* Works as expected under JDK 1.0.2 where blocking
* is immediate. However, the modal block in
* JDK 1.1.3 is slow to respond to the lock.
*
* Same behavior on SGI/IRIX 5.3 and DEC Alpha OSF.
*/
import java.awt.*;
import java.applet.*;
class TestDialog extends Dialog {
public TestDialog(Frame parent, String title) {
super(parent, title, true);
System.err.println("create: " + title);
setLayout(new BorderLayout(15,15));
// do something that takes a little time
for (int i=1; i < 100000; i++)
new Integer(i);
add("Center", new Label("This a test", Label.CENTER));
add("South", new Button("Ok"));
resize(200,80);
System.err.println("show: " + title);
show();
}
public boolean action (Event e, Object arg) {
if (e.target instanceof Button) {
hide();
dispose();
return true;
}
return false;
}
}
------- BugDialog.java ----------
import java.awt.*;
import java.applet.*;
public class BugDialog extends Applet {
int count = 1;
boolean workaround = false;
public BugDialog() {
add(new Button("Create Modal Dialog..."));
add(new Checkbox("Enable workaround"));
resize(100,100);
}
public boolean action(Event e, Object o) {
if (e.target instanceof Button) {
Container parent = getParent();
while (parent != null && ! (parent instanceof Frame) )
parent = parent.getParent();
if (workaround) disable();
new TestDialog((Frame)parent, "Modal Dialog " + count++);
if (workaround) enable();
} else if (e.target instanceof Checkbox) {
workaround = ((Checkbox)e.target).getState();
System.err.println("workaround " + workaround);
} else {
return false;
}
return true;
}
public static void main (String args[])
{
Frame f = new Frame("BugDialog");
BugDialog d = new BugDialog();
d.init();
d.start();
f.add("Center", d);
f.pack();
f.show();
}
}
======================================================================
- backported by
-
JDK-2017582 Multiple modal dialogs can be created before block takes effect
- Resolved
-
JDK-2017583 Multiple modal dialogs can be created before block takes effect
- Resolved
-
JDK-2017581 Multiple modal dialogs can be created before block takes effect
- Closed
- duplicates
-
JDK-4311794 modal dialog dispatcher thread is fired up before dialog actually appears
- Closed
- relates to
-
JDK-4434193 ActionEvents (and other events) need timestamps
- Resolved
-
JDK-4403757 Modal Dialog does not block Drag&Drop events
- Closed
(1 relates to)