diff options
author | Adam Domurad <[email protected]> | 2013-05-02 12:28:10 -0400 |
---|---|---|
committer | Adam Domurad <[email protected]> | 2013-05-02 12:28:10 -0400 |
commit | 8ec0bf0612cb8cdb6e3956996ce4a249505dd429 (patch) | |
tree | 52523c4d0665349b4e558ed2360d8110238b4d80 /plugin/icedteanp/java/sun/applet/PluginAppletPanelFactory.java | |
parent | 04db48f1281ec6362870a3226e5e37fef208a9a5 (diff) |
Ensure that PluginAppletViewer is resized in case of error.
Diffstat (limited to 'plugin/icedteanp/java/sun/applet/PluginAppletPanelFactory.java')
-rw-r--r-- | plugin/icedteanp/java/sun/applet/PluginAppletPanelFactory.java | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/plugin/icedteanp/java/sun/applet/PluginAppletPanelFactory.java b/plugin/icedteanp/java/sun/applet/PluginAppletPanelFactory.java index 961df66..e368eca 100644 --- a/plugin/icedteanp/java/sun/applet/PluginAppletPanelFactory.java +++ b/plugin/icedteanp/java/sun/applet/PluginAppletPanelFactory.java @@ -112,13 +112,14 @@ class PluginAppletPanelFactory { }, "NetXPanel initializer"); panelInit.start(); - while(panelInit.isAlive()) { - try { - panelInit.join(); - } catch (InterruptedException e) { - } + try { + panelInit.join(); + } catch (InterruptedException e) { + e.printStackTrace(); } + setAppletViewerSize(panel, params.getWidth(), params.getHeight()); + // Wait for the panel to initialize PluginAppletViewer.waitForAppletInit(panel); @@ -133,42 +134,40 @@ class PluginAppletPanelFactory { PluginDebug.debug("Applet ", a.getClass(), " initialized"); streamhandler.write("instance " + identifier + " reference 0 initialized"); - /* AppletViewerPanel sometimes doesn't set size right initially. This - * causes the parent frame to be the default (10x10) size. - * - * Normally it goes unnoticed since browsers like Firefox make a resize - * call after init. However some browsers (e.g. Midori) don't. - * - * We therefore manually set the parent to the right size. - */ + panel.removeSplash(); + + AppletSecurityContextManager.getSecurityContext(0).associateSrc(panel.getAppletClassLoader(), doc); + AppletSecurityContextManager.getSecurityContext(0).associateInstance(identifier, panel.getAppletClassLoader()); + + return panel; + } + + /* AppletViewerPanel sometimes doesn't set size right initially. This + * causes the parent frame to be the default (10x10) size. + * + * Normally it goes unnoticed since browsers like Firefox make a resize + * call after init. However some browsers (e.g. Midori) don't. + * + * We therefore manually set the parent to the right size. + */ + static private void setAppletViewerSize(final AppletPanel panel, + final int width, final int height) { try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { - panel.getParent().setSize(params.getWidth(), params.getHeight()); + panel.getParent().setSize(width, height); } }); - } catch (InvocationTargetException ite) { + } catch (InvocationTargetException e) { // Not being able to resize is non-fatal PluginDebug.debug("Unable to resize panel: "); - ite.printStackTrace(); - } catch (InterruptedException ie) { + e.printStackTrace(); + } catch (InterruptedException e) { // Not being able to resize is non-fatal PluginDebug.debug("Unable to resize panel: "); - ie.printStackTrace(); + e.printStackTrace(); } - - panel.removeSplash(); - - AppletSecurityContextManager.getSecurityContext(0).associateSrc(panel.getAppletClassLoader(), doc); - AppletSecurityContextManager.getSecurityContext(0).associateInstance(identifier, panel.getAppletClassLoader()); - - return panel; } - - public boolean isStandalone() { - return false; - } - /** * Send the initial set of events to the appletviewer event queue. * On start-up the current behaviour is to load the applet and call |