Here I explain how to insert Java applets on a Google Sites website (this one!). I provide a working example and source code.
For a broader intro to building applets, you'll have to look somewhere else. I recommend Processing, a sweet open-source environment that acts like an electronic sketchbook. For finer details about embedding applets or other objects in HTML, Google is your friend.
Java applets are a great way to add interactive content to your website.
For example, drawing circles with your mouse is quite entertaining... try it!
Unfortunately, while Google Sites provides a way to directly hack at the HTML underlying a page, it filters user input and throws out any content within "dangerous" tags such as <applet> or <object>. This eliminates the straightforward way to add an applet.
The work-around is to use a custom gadget that provides a wrapper for user-provided code. For those who need an intro on gadgets, check out Google's getting started guide.
To insert a code wrapper gadget on Google Sites, go to Edit page ► Insert ► More gadgets and type "code wrapper" into the search box. The Code Wrapper gadget should be at the top of the list.
The bold lines are the ones you'll want to tweak for your own purposes. Note that you *can* give an absolute URL path to the applet JAR archive and it works just fine, so the applet files do not need to by attached to the particular page or located in the same directory.
That's it! Enjoy, just be sure to be careful about what you add into the code wrapper... some applets or scripts may not play nice with Google Sites functionality, so tread carefully.