[2410] in java-interest
Re: Resizing Applet
daemon@ATHENA.MIT.EDU (Adam Doppelt)
Sat Sep 30 16:56:37 1995
From: Adam Doppelt <amd@cs.brown.edu>
To: java-interest@java.sun.com
Date: Sat, 30 Sep 1995 14:45:06 -0400 (EDT)
Cc: mtw@kodak.com
> Is there any way to resize an Applet. The
> resize() method doesn't seem to work.
>
> Can anyone provide me with the code that will
> make it work. How about the resize() method
> code.
>
> I am preparing for a demo and it would be great
> if it could automatically resize instead of
> having to do it manually.
I have been playing with this myself, and I don't think there is a any
way to do it. However, there is an easy way to find out what size an
applet "wants" to be, and to set the size of an applet from within the
APPLET tag.
Here is a small method which prints out what size an applet wants to
be, assuming you are using AWT's layout managers:
public void PrintPreferredSize() {
System.out.println(getClass().getName() +
" preferred size is: " +
"WIDTH=" + preferredSize().width +
" HEIGHT=" + preferredSize().height);
}
You can then set the size of the applet from within the applet
tag. For example:
<APPLET CODE="gub.class" WIDTH=220 HEIGHT=310>
Not a java browser.
</APPLET>
The AppletViewer, and hopefully Netscape and HotJava as well, will
read the width and height parameters and resize accordingly. If you
want to actually resize after your applet has started executing, I
think you're out of luck.
Adam
----------------------------------------------------------------------
Adam Doppelt http://www.cs.brown.edu/people/amd amd@cs.brown.edu
----------------------------------------------------------------------
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com