Chapter 10
Introduction to Java Applets
Java was born in 1995, shortly after the Internet became available to the public. The Netscape web browser enabled regular people to go online and download content from remote servers. This content was mainly some formatted text mixed with static images. But the Java programming language provided a way to incorporate downloadable applications into the web pages!
A programmer needed to write a Java application called an applet in a special way using GUI classes from the java.awt package (Swing was not invented yet). Applets were deployed on the web servers along with the HTML files that included references to the applets. Web browsers understand HTML, the markup that consists of special tags placed in text files so web browsers can properly format and lay out web pages. HTML has a special tag, <applet>, that tells the browser where to find and how to size and align a Java applet.
You can download a Java applet to your computer from the Internet as part of a web page, and web browsers use the JVM plug-in to run applets. The version of JVM included with a web browser is very important, because if you’re using, say, Java Swing classes, but the user’s web browser has a really old JVM, the browser won’t even know how to run the code that your applet uses.
In this lesson you’ll learn the basics of applet creation and the applet’s life cycle. In Lesson 11 you’ll build a tic-tac-toe game and will deploy it on the web server so other people can ...