created: 03/07/1998; revised: 07/15/2002, 08/18/2003, 11/02/2003, 02/11/2006, 12/03/2010
JApplet classpaint() methodGraphics classGraphics class:
setColor()drawOval()drawLine()This chapter can safely be skipped. Applets are only used occasionally in the following chapters.
This chapter examines Java applets. An applet is an object that can be part of a web page much like an image can be part of a web page. The applet is written in Java and compiled just as any Java program. An applet controls the graphical components and user interaction in a rectangular section of the Web browser's screen.
When you view a page that contains an applet, the applet's code is transferred to your computer and executed by the Java Virtual Machine. The output of the applet is displayed in a rectangular portion of the browser. However, your browser must have applets enabled. If your browser is has applets enabled, you will the following applet, which displays a circle in a white rectangle.
These notes discuss the
JApplet class that
is part of the Swing set of components.
(Thought Question: ) Is an applet a Java application?