This section shows you how to build a simple Java applet: a paint program. You'll be introduced to the basic steps needed to create an applet and to add functionality.
Here is a demonstration of PaintApp. Use the left mouse button to draw and the right button to clear.
1 | The Applet Skeleton Declaring classes, extending the Applet class, importing packages |
2 | The Drawing Buffer Declaring fields and methods, applet initialization, graphics objects |
3 | Color and the Graphic Routines Drawing rectangles, modifying drawing behavior |
4 | Mouse Events Event handlers, the if statement, functions, drawing lines |
5 | Applet Parameters and Errors The <PARAM> tag, strings, error handling, documentation |
PaintApp Listing PaintApp Test Page |