Applet Basics

Applets are regular Java classes that extend Applet. Because of this, you can do just about anything that Java allows you to do from within an applet that runs in its own space on the client. There are, however, key restrictions. For example, you are not allowed to open a socket connection from inside your applet, except one back to the same server from which the applet came. Additionally, you cannot access the local file system. Beyond constraints such as these, applets are very powerful.

There are a few steps to getting an applet running on a client.

  • Write a Java class that extends the java.applet.Applet class or javax.swing.JApplet class and imports the packages you need.

  • Write an HTML page that calls the applet using the HTML ...

Get Java Garage now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.