Applets are Java programs embedded into web pages, allowing most of the functionality of a Java application but removing the need for separate downloading and installation. They user can interact with applets and pass responses back to process on the web server such as databases. They perform a similar role to flash pages except they come with some advantages (and disadvantages) by comparison. Flash has the advantage that it is especially suitable for creating animated images, and a user can do that with almost no knowledge of programming. As flash has developed programming features have been added. Java has the advantage of being an industrial strength programming language that was designed from the ground up for software engineering. It also has more support for encryption and security than any alternative technology.
You can see how complex an applet can be by running the applet embedded in the SwingSet2.htm file that gets installed with the JDK. With my installation of the JDK this was installed at
Yours may be slightly different, but it will probably be found under the demo/jfc directory of your JDK installation.