It's not a secret anymore!
The moose likes Applets and the fly likes animation question: resize applet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "animation question: resize applet?" Watch "animation question: resize applet?" New topic

animation question: resize applet?

f. nikita thomas
Ranch Hand

Joined: Mar 02, 2008
Posts: 87
the issue with the following code is this:

i'm using eclipse to run it with the applet viewer. when the applet first opens i can see the upper portion of the animation correctly; however if i resize the frame all i see is the arms and legs ...

i tried putting this in a webpage but it failed, and i don't know html, <don't laugh>, enough to correct the problem there.

any help will ...

thanks in advance ...

Imagination is more important than knowledge "Albert Einstein"
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
I haven't looked at the code, but resizing is not an option for applets. They have a fixed size that can't be changed once they're part of an HTML page.

The Applet FAQ points to the Java Tutorial section on applet tags in HTML:
Rob Spoor

Joined: Oct 27, 2005
Posts: 20271

Actually applets can be resized, but it involves JavaScript. I have used the following quite successfully:

This even works with applets defined in an <object> HTML element.

You have to call it in the HTML body's onLoad and onResize events.
[ September 28, 2008: Message edited by: Rob Prime ]

How To Ask Questions How To Answer Questions
f. nikita thomas
Ranch Hand

Joined: Mar 02, 2008
Posts: 87
wow, moved again...

anyway i have a partial solution to my problem. added these lines to my paint() method.

this is an example that my instructor gave us. it just made sense to redraw the head and trunk again. now i'm still stuck on why the background color doesn't resize with the frame(white where cyan ought to be), and of course the failure of the class to initialize in webpage<ie,mozilla,konqueror> again any help will ...

thanks again.

I agree. Here's the link:
subject: animation question: resize applet?
It's not a secret anymore!