tags:

views:

62

answers:

2

I want to create an applet that when embedded into html page does not make it look like an applet. Meaning it should go good with webpage and should not look as if it is some separate thing. It should look as if it's a part of HTML. I want my applet to look beautiful. How can I achieve that?

+1  A: 

You might find the Metamorphosis demo interesting, as it explains how to make Swing applications and applets nicer.

http://www.jgoodies.com/freeware/metamorphosis/index.html

Thorbjørn Ravn Andersen
+1  A: 

Depending on what your applet does, the result might not be perfect.

If your applet is only drawing things that do not rely on GUI components, you just need a Canvas and draw beautiful things in it. People expect anything in web pages today.

You will start having problems if you need GUI components (i.e. buttons, menus, windows, etc...). Each OS has its own GUI. Even though Java is helping, to get an applet matching the OS GUI is already difficult (for instance you could have to use QuaQua for MacOS). You can get the OS name with System.getProperty().

But to make matters worse, each web browser can change that GUI in subtle ways, and that changes with each version of the brower, the JVM and the OS. You can't get the browser name directly from the applet. In theory, you could send the info to the applet using javascript, and build your GUI based on that, but in practice that would be a nightmare.

It might be easier to make your applet beautiful than to make it look like it is not an applet. Especially since people who are loading the JVM for the first time in the browser are likely to see an nice Java logo on your applet while the JVM is loading (unless you make it load in an earlier page with a 1x1 applet :-)

Damien