What do you suppose happens if you forget the match to a
<head>
tag?
The rest of the file is regarded as part of the head, and will not show up in the browser as you expect.
The previous applets in this chapter have only printed text. Here is an applet that draws a circle.
import javax.swing.JApplet; import java.awt.*; // assume that the drawing area is 150 by 150 public class JustOneCircle extends JApplet { final int radius = 25; public void paint ( Graphics gr ) { setBackground( Color.lightGray ); gr.drawOval( (150/2 - radius), (150/2 - radius), radius*2, radius*2 ); } }
Here is what the applet paints with your Web browser:
What is the name of the method that drew the circle?