class JApplet
Here is the skeleton for our applet:
import javax.swing.JApplet; import java.awt.* ; import java.lang.Math ; public class SnowFlakeBasic extends JApplet { Graphics graph; // draw a star consisting of six lines of length size // radiating from the point (x,y) // private void drawStar( int x, int y, int size ) { . . . . } public void paint ( Graphics gr ) { graph = gr; int width = getSize().width; int height = getSize().height; . . . . . drawStar( . . . . ); } }
We extend the JApplet
class and override the
paint()
method.
The paint()
method is called when the browser needs to fill
in the applet's part of the screen.
(Lucky Guess Department: ) What do you suppose the following does?
int width = getSize().width; int height = getSize().height;