3.2. Controlling fonts and colors with Java applets

Undoubtedly, one of the most popular applications of using Java is through embedding applets in HTML/XHTML pages. An applet, in general, is a small program which will run automatically when downloaded into the browser. Java applets are applet programs written in Java. Throughout this chapter, the word applet refers to a Java applet.

3.2.1. A simple Java applet

Let’s convert the first Java program HelloWorld.java into an applet. Generally you need to perform the following tasks when creating any applet applications:

  • Create a Java program to generate the applet application.

  • Compile the source code files into bytecode or class.

  • Create an HTML/XHTML page and use the applet element <applet> to call ...

Get Practical Web Technologies 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.