jdk/src/share/classes/sun/applet/AppletPanel.java
Print this page
rev 5693 : 7192977: Issue in toolkit thread
Reviewed-by: skoivu, rupashka, art
@@ -43,10 +43,11 @@
import java.security.*;
import java.util.*;
import java.util.Collections;
import java.util.Locale;
import java.util.WeakHashMap;
+import sun.awt.AWTAccessor;
import sun.awt.AppContext;
import sun.awt.EmbeddedFrame;
import sun.awt.SunToolkit;
import sun.misc.MessageUtils;
import sun.misc.PerformanceLogger;
@@ -446,16 +447,16 @@
// Validate the applet in event dispatch thread
// to avoid deadlock.
try {
final AppletPanel p = this;
-
- EventQueue.invokeAndWait(new Runnable() {
+ Runnable r = new Runnable() {
public void run() {
p.validate();
}
- });
+ };
+ AWTAccessor.getEventQueueAccessor().invokeAndWait(applet, r);
}
catch(InterruptedException ie) {
}
catch(InvocationTargetException ite) {
}
@@ -476,22 +477,23 @@
// Validate and show the applet in event dispatch thread
// to avoid deadlock.
try {
final AppletPanel p = this;
final Applet a = applet;
-
- EventQueue.invokeAndWait(new Runnable() {
+ Runnable r = new Runnable() {
public void run() {
p.validate();
a.setVisible(true);
// Fix for BugTraq ID 4041703.
// Set the default focus for an applet.
- if (hasInitialFocus())
+ if (hasInitialFocus()) {
setDefaultFocus();
}
- });
+ }
+ };
+ AWTAccessor.getEventQueueAccessor().invokeAndWait(applet, r);
}
catch(InterruptedException ie) {
}
catch(InvocationTargetException ite) {
}
@@ -510,17 +512,16 @@
// Hide the applet in event dispatch thread
// to avoid deadlock.
try {
final Applet a = applet;
-
- EventQueue.invokeAndWait(new Runnable() {
- public void run()
- {
+ Runnable r = new Runnable() {
+ public void run() {
a.setVisible(false);
}
- });
+ };
+ AWTAccessor.getEventQueueAccessor().invokeAndWait(applet, r);
}
catch(InterruptedException ie) {
}
catch(InvocationTargetException ite) {
}
@@ -568,21 +569,18 @@
showAppletStatus("notdestroyed");
break;
}
status = APPLET_DISPOSE;
- try
- {
+ try {
final Applet a = applet;
-
- EventQueue.invokeAndWait(new Runnable()
- {
- public void run()
- {
+ Runnable r = new Runnable() {
+ public void run() {
remove(a);
}
- });
+ };
+ AWTAccessor.getEventQueueAccessor().invokeAndWait(applet, r);
}
catch(InterruptedException ie)
{
}
catch(InvocationTargetException ite)