diff --git a/sources/net.sf.j2s.core/dist/swingjs/SwingJS-site.zip b/sources/net.sf.j2s.core/dist/swingjs/SwingJS-site.zip index 590685b1e..c0ebd8f2d 100644 Binary files a/sources/net.sf.j2s.core/dist/swingjs/SwingJS-site.zip and b/sources/net.sf.j2s.core/dist/swingjs/SwingJS-site.zip differ diff --git a/sources/net.sf.j2s.core/dist/swingjs/timestamp b/sources/net.sf.j2s.core/dist/swingjs/timestamp index 8ae2a7f76..6366f7bd5 100644 --- a/sources/net.sf.j2s.core/dist/swingjs/timestamp +++ b/sources/net.sf.j2s.core/dist/swingjs/timestamp @@ -1 +1 @@ -20191020181703 +20191021071533 diff --git a/sources/net.sf.j2s.core/dist/swingjs/ver/3.2.4/SwingJS-site.zip b/sources/net.sf.j2s.core/dist/swingjs/ver/3.2.4/SwingJS-site.zip index 590685b1e..c0ebd8f2d 100644 Binary files a/sources/net.sf.j2s.core/dist/swingjs/ver/3.2.4/SwingJS-site.zip and b/sources/net.sf.j2s.core/dist/swingjs/ver/3.2.4/SwingJS-site.zip differ diff --git a/sources/net.sf.j2s.core/dist/swingjs/ver/3.2.4/timestamp b/sources/net.sf.j2s.core/dist/swingjs/ver/3.2.4/timestamp index 8ae2a7f76..6366f7bd5 100644 --- a/sources/net.sf.j2s.core/dist/swingjs/ver/3.2.4/timestamp +++ b/sources/net.sf.j2s.core/dist/swingjs/ver/3.2.4/timestamp @@ -1 +1 @@ -20191020181703 +20191021071533 diff --git a/sources/net.sf.j2s.java.core/dist/SwingJS-site.zip b/sources/net.sf.j2s.java.core/dist/SwingJS-site.zip index 590685b1e..c0ebd8f2d 100644 Binary files a/sources/net.sf.j2s.java.core/dist/SwingJS-site.zip and b/sources/net.sf.j2s.java.core/dist/SwingJS-site.zip differ diff --git a/sources/net.sf.j2s.java.core/src/java/lang/Thread.java b/sources/net.sf.j2s.java.core/src/java/lang/Thread.java index 797affe4a..484a8195f 100644 --- a/sources/net.sf.j2s.java.core/src/java/lang/Thread.java +++ b/sources/net.sf.j2s.java.core/src/java/lang/Thread.java @@ -320,7 +320,7 @@ public static void yield() { */ public static void sleep(long millis) throws InterruptedException { JSUtil.notImplemented(null); - JSUtil.warn("SwingJS does not implement Thread.sleep(long)"); + throw new InterruptedException("SwingJS does not implement Thread.sleep(long)"); } /** * Causes the currently executing thread to sleep (cease execution) @@ -354,7 +354,7 @@ public static void sleep(long millis, int nanos) millis++; } JSUtil.notImplemented(null); - JSUtil.warn("SwingJS does not implement Thread.sleep(long,int)"); + throw new InterruptedException("SwingJS does not implement Thread.sleep(long,int)"); // sleep(millis); } diff --git a/sources/net.sf.j2s.java.core/src/swingjs/JSAppletViewer.java b/sources/net.sf.j2s.java.core/src/swingjs/JSAppletViewer.java index fcd07f74c..dbf87f51f 100644 --- a/sources/net.sf.j2s.java.core/src/swingjs/JSAppletViewer.java +++ b/sources/net.sf.j2s.java.core/src/swingjs/JSAppletViewer.java @@ -458,7 +458,7 @@ public int run1(int mode) { } // BH: This should not be necessary. // It is causing validation to happen twice, - // But actually that is a good thing, because we don't + // But actually that is a good thing, because we don't // see the flash of incomplete to complete layout. applet.getRootPane().addNotify(); // force peer creation now @@ -472,18 +472,10 @@ public int run1(int mode) { ok = true; break; case APPLET_READY: - applet.getContentPane().setBounds(applet.getBounds()); // added - // 7/13/17; - // applet - // background - // was - // not - // painting - // if - // setContentPane() - // was - // used - applet.setVisible(true); + applet.getContentPane().setBounds(applet.getBounds()); + // added 7/13/17; applet background was not painting + // if setContentPane() was used + applet.setVisible(true); applet.validate(); // one last validation necessary for PolyhedronApplet showAppletStatus("ready"); JSUtil.readyCallback(appletName, fullName, applet, this); @@ -492,7 +484,10 @@ public int run1(int mode) { if (resizer != null) resizer.show(); } - JSFocusPeer.setFocusLast(applet); + // NO! JSFocusPeer.setFocusLast(applet); + // 2019.10.21 Problem here is that the page will scroll to the + // applet even if it is down on the page. + applet.秘repaint(); break; case APPLET_STOP: diff --git a/sources/net.sf.j2s.java.core/src/swingjs/JSToolkit.java b/sources/net.sf.j2s.java.core/src/swingjs/JSToolkit.java index 0a70bc96c..77c32df37 100644 --- a/sources/net.sf.j2s.java.core/src/swingjs/JSToolkit.java +++ b/sources/net.sf.j2s.java.core/src/swingjs/JSToolkit.java @@ -295,10 +295,6 @@ public static JSComponentUI getComponentUI(JComponent target) { return ui; } - public static String getSwingDivId() { - return Thread.currentThread().getName() + "_swingdiv"; - } - private static int dispatchID = 0; /** diff --git a/sources/net.sf.j2s.java.core/src/swingjs/plaf/JSFrameUI.java b/sources/net.sf.j2s.java.core/src/swingjs/plaf/JSFrameUI.java index bf22c890b..7cb74282a 100644 --- a/sources/net.sf.j2s.java.core/src/swingjs/plaf/JSFrameUI.java +++ b/sources/net.sf.j2s.java.core/src/swingjs/plaf/JSFrameUI.java @@ -58,15 +58,6 @@ public class JSFrameUI extends JSWindowUI implements FramePeer, JSComponentUI.Em // for our purposes, a frame will be synonymous with a non-imbedded applet or a // dialog. - // Applet: xxx_appletinfotablediv (fixed w&h) - // / \ - // z 200000 xxx_swingdiv (rootpane, fixed w&h) \ - // z 200001 xxx_appletdiv (w,h 100%) xxx_infotablediv (System.out) - // z 200002 xxx_canvas2d (w,h 100%) - // z 200003 xxx_contentLayer (fixed w&h) - // xxx_2dappletdiv (w,h 100%; could be used for the glassPane) - // - protected JFrame frame; // private String title; private int state; diff --git a/sources/net.sf.j2s.java.core/src/swingjs/plaf/JSTextUI.java b/sources/net.sf.j2s.java.core/src/swingjs/plaf/JSTextUI.java index e44ebb567..1eca9ec7d 100644 --- a/sources/net.sf.j2s.java.core/src/swingjs/plaf/JSTextUI.java +++ b/sources/net.sf.j2s.java.core/src/swingjs/plaf/JSTextUI.java @@ -1137,7 +1137,7 @@ void setJSText() { @Override public boolean focus() { - if (!super.focus()) + if (!editor.isEditable() || !super.focus()) return false; if (haveFocus()) { diff --git a/sources/net.sf.j2s.java.core/srcjs/js/j2sApplet.js b/sources/net.sf.j2s.java.core/srcjs/js/j2sApplet.js index 292c8638e..1b3c13771 100644 --- a/sources/net.sf.j2s.java.core/srcjs/js/j2sApplet.js +++ b/sources/net.sf.j2s.java.core/srcjs/js/j2sApplet.js @@ -3046,8 +3046,7 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) { J2S.getResourcePath = function(path, isJavaPath) { if (!path || path.indexOf("https:/") != 0 && path.indexOf("https:/") != 0 && path.indexOf("file:/") != 0) { - var applet = J2S._applets[Clazz.loadClass("java.lang.Thread").currentThread$() - .getName$()]; + var applet = Thread.currentThread$().getThreadGroup$().秘html5Applet; path = (!isJavaPath && applet.__Info.resourcePath || applet.__Info.j2sPath) + "/" + (path || ""); } diff --git a/sources/net.sf.j2s.java.core/srcjs/swingjs2.js b/sources/net.sf.j2s.java.core/srcjs/swingjs2.js index 0db43ed78..50736b5df 100644 --- a/sources/net.sf.j2s.java.core/srcjs/swingjs2.js +++ b/sources/net.sf.j2s.java.core/srcjs/swingjs2.js @@ -13715,8 +13715,7 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) { J2S.getResourcePath = function(path, isJavaPath) { if (!path || path.indexOf("https:/") != 0 && path.indexOf("https:/") != 0 && path.indexOf("file:/") != 0) { - var applet = J2S._applets[Clazz.loadClass("java.lang.Thread").currentThread$() - .getName$()]; + var applet = Thread.currentThread$().getThreadGroup$().秘html5Applet; path = (!isJavaPath && applet.__Info.resourcePath || applet.__Info.j2sPath) + "/" + (path || ""); }