diff options
Diffstat (limited to 'libjava/java/applet/Applet.java')
-rw-r--r-- | libjava/java/applet/Applet.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/libjava/java/applet/Applet.java b/libjava/java/applet/Applet.java index 5990c63..27c8aaf 100644 --- a/libjava/java/applet/Applet.java +++ b/libjava/java/applet/Applet.java @@ -78,6 +78,11 @@ public class Applet extends Panel private transient AppletStub stub; /** + * The dimensions passed to this applet through its HTML tag. + */ + private transient Dimension dimensions; + + /** * The accessibility context for this applet. * * @serial the accessibleContext for this @@ -457,6 +462,41 @@ public class Applet extends Panel s.defaultReadObject(); } + private Dimension getDimensions () + { + if (dimensions == null) + { + int width = Integer.parseInt(stub.getParameter("width")); + int height = Integer.parseInt(stub.getParameter("height")); + + dimensions = new Dimension(width, height); + } + + return dimensions; + } + + /** + * Returns an instance of {@link Dimension} representing the + * applet's width and height parameters. + * + * @return the applet's preferred size + */ + public Dimension preferredSize() + { + return getDimensions (); + } + + /** + * Returns an instance of {@link Dimension} representing the + * applet's width and height parameters. + * + * @return the applet's minimum size + */ + public Dimension minimumSize() + { + return getDimensions (); + } + /** * This class provides accessibility support for Applets, and is the * runtime type returned by {@link #getAccessibleContext()}. |