File tree Expand file tree Collapse file tree 4 files changed +15
-15
lines changed
sources/net.sf.j2s.java.core/src Expand file tree Collapse file tree 4 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -2976,12 +2976,12 @@ public void setLocationRelativeTo(Component c) {
29762976 Container root =null ;
29772977
29782978 if (c != null ) {
2979- if (c instanceof Window || c instanceof JSApplet ) {
2979+ if (c . isWindowOrJSApplet () ) {
29802980 root = (Container )c ;
29812981 } else {
29822982 Container parent ;
29832983 for (parent = c .getParent () ; parent != null ; parent = parent .getParent ()) {
2984- if (parent instanceof Window || parent instanceof JSApplet ) {
2984+ if (parent . isWindowOrJSApplet () ) {
29852985 root = parent ;
29862986 break ;
29872987 }
Original file line number Diff line number Diff line change 2828
2929package java .awt .event ;
3030
31+ import java .applet .JSApplet ;
32+ import java .awt .Component ;
3133import java .awt .Window ;
3234import sun .awt .AppContext ;
3335import sun .awt .SunToolkit ;
@@ -282,7 +284,8 @@ public WindowEvent(Window source, int id) {
282284 * @return the Window object that originated the event
283285 */
284286 public Window getWindow () {
285- return (source instanceof Window ) ? (Window )source : null ;
287+ // SwingJS we are saying that embedded applets are windows here
288+ return (((Component )source ).isWindowOrJSApplet ()) ? (Window )source : null ;
286289 }
287290
288291 /**
Original file line number Diff line number Diff line change @@ -281,7 +281,7 @@ void showTipWindow() {
281281 if (insideComponent == null || !insideComponent .isShowing ())
282282 return ;
283283 Component win = insideComponent .getTopLevelAncestor ();
284- if (win instanceof Window ) {
284+ if (win . isWindowOrJSApplet () ) {
285285 if (((Window ) win ).getModalBlocker () != null )
286286 return ;
287287 }
Original file line number Diff line number Diff line change 1010import javax .swing .JApplet ;
1111import javax .swing .JComponent ;
1212
13+ import swingjs .JSUtil ;
14+
1315public class Applet extends JApplet implements A2SContainer {
1416
1517
@@ -34,22 +36,17 @@ public Applet() throws HeadlessException {
3436 *
3537 */
3638 static void fixAWTPaint (Component c , Class <?> cl ) {
37-
39+ Object f = JSUtil .getJ2SAlias (c , "paint$java_awt_Graphics" );
40+ if (JSUtil .isOverridden (f , cl )
41+ && f .toString ().indexOf ("C$.superclazz.prototype.paint$java_awt_Graphics.apply(this" ) < 0 ) {
3842 /**@j2sNative
3943 *
40- * try{
41- * var f = c.paint$java_awt_Graphics;
42- * if (f.exClazz != cl.$clazz$ && f.toString().indexOf("C$.superclazz.prototype.paint$java_awt_Graphics.apply(this") < 0) {
43- * var oldPaint = f;
4444 * c.paint$java_awt_Graphics = function(g) {
4545 * cl.$clazz$.prototype.paint$java_awt_Graphics.apply(c,[g]);
46- * oldPaint.apply(c,[g]);
47- * };
48- * }
49- * } catch(e) {
50- * System.out.println("java.applet.Applet.fixAppletPaint() exception: " + e);
51- * }
46+ * f.apply(c,[g]);
47+ * }
5248 */
49+ }
5350 }
5451
5552
You can’t perform that action at this time.
0 commit comments