Difficulty resizing window inside an Applet  
Author Message
Dave





PostPosted: 2006-7-26 6:51:00 Top

java-programmer, Difficulty resizing window inside an Applet Hi all,

I have a Java puzzle written as an applet that I've been working on. So far
I've never been able to figure out how to resize it from inside the applet
itself.

So I created a very elaborate HTML file, where I use JavaScript which:
1. queries the screen resolution and browser,
2. dynamically opens a window based on the values returned from (1),
3. dynamically writes the applet/object tag to that window also based on
(1).

I'd love to get rid of this complicated mess of html/js code and do it from
pure Java if I can. For one thing, having two page refreshes is slow for the
user. I've tried setSize() and setBounds from every component level I can
think of. There are never any errors but it never works either. I noticed
that resize() works from inside a JDialog, but not from JPanel. I'd be happy
to use a JDialog to hold the JPEG image, instead of JPanel, but that doesn't
seem to work.

Also, I'd love to be able to resize on the fly. Is it a big deal to trap the
window/resize event to allow the user to set the size?

I'd greatly appreciate any thoughts or ideas you may have.

Best regards,

Dave