20.3. Simple Java Applet: Drawing a String
Every Java applet is a graphical user interface on which you can place GUI components using the techniques introduced in Chapter 11 or draw using the techniques demonstrated in Chapter 12. In this chapter, we will demonstrate drawing on an applet. Examples in Chapters 21, 23 and 24 demonstrate building an applet’s graphical user interface.
Now let’s build an applet of our own. We begin with a simple applet (Fig. 20.6) that draws "Welcome to Java Programming!" on the applet. Figure 20.7 shows this applet executing in two applet containers—the appletviewer and the Microsoft Internet Explorer web browser. At the end of this section, you will learn how to execute the applet in a web browser.