|
36 | 36 | import java.util.ListIterator; |
37 | 37 | import java.util.Set; |
38 | 38 |
|
| 39 | +import javax.swing.JApplet; |
39 | 40 | import javax.swing.JComponent; |
40 | 41 | import javax.swing.SwingUtilities; |
41 | 42 |
|
@@ -111,8 +112,19 @@ public String toString() { |
111 | 112 | } |
112 | 113 | } |
113 | 114 |
|
| 115 | + /** |
| 116 | + * SwingJS treats JApplet as a window. I know... just how it is. |
| 117 | + * |
| 118 | + * @param window |
| 119 | + * @return |
| 120 | + */ |
114 | 121 | private Window getOwningFrameDialog(Window window) { |
115 | | - while (window != null && !(window instanceof JSFrame || window instanceof JSDialog)) { |
| 122 | + @SuppressWarnings("unused") |
| 123 | + Object owindow; |
| 124 | + while (window != null && !( |
| 125 | + (owindow = window) instanceof JApplet |
| 126 | + || window instanceof JSFrame |
| 127 | + || window instanceof JSDialog)) { |
116 | 128 | window = (Window) window.getParent(); |
117 | 129 | } |
118 | 130 | return window; |
@@ -238,25 +250,27 @@ static boolean sendMessage(Component target, AWTEvent e) { |
238 | 250 | if (targetAppContext.isDisposed()) { |
239 | 251 | return false; |
240 | 252 | } |
241 | | - SunToolkit.postEvent(targetAppContext, se); |
242 | | - if (EventQueue.isDispatchThread()) { |
243 | | - EventDispatchThread edt = (EventDispatchThread) Thread.currentThread(); |
244 | | - edt.pumpEvents(SentEvent.ID, new Conditional() { |
245 | | - public boolean evaluate() { |
246 | | - return !se.dispatched && !targetAppContext.isDisposed(); |
247 | | - } |
248 | | - }); |
249 | | - } else { |
250 | | - synchronized (se) { |
251 | | - while (!se.dispatched && !targetAppContext.isDisposed()) { |
252 | | - try { |
253 | | - se.wait(1000); |
254 | | - } catch (InterruptedException ie) { |
255 | | - break; |
256 | | - } |
257 | | - } |
258 | | - } |
259 | | - } |
| 253 | + // SwingJS - do we care? |
| 254 | + se.dispatch(); |
| 255 | +// SunToolkit.postEvent(targetAppContext, se); |
| 256 | +// if (EventQueue.isDispatchThread()) { |
| 257 | +// EventDispatchThread edt = (EventDispatchThread) Thread.currentThread(); |
| 258 | +// edt.pumpEvents(SentEvent.ID, new Conditional() { |
| 259 | +// public boolean evaluate() { |
| 260 | +// return !se.dispatched && !targetAppContext.isDisposed(); |
| 261 | +// } |
| 262 | +// }); |
| 263 | +// } else { |
| 264 | +// synchronized (se) { |
| 265 | +// while (!se.dispatched && !targetAppContext.isDisposed()) { |
| 266 | +// try { |
| 267 | +// se.wait(1000); |
| 268 | +// } catch (InterruptedException ie) { |
| 269 | +// break; |
| 270 | +// } |
| 271 | +// } |
| 272 | +// } |
| 273 | +// } |
260 | 274 | } |
261 | 275 | return se.dispatched; |
262 | 276 | } |
|
0 commit comments