CS 596 Java Programming Fall Semester, 1998 Basic Applet Methods |
||
---|---|---|
San Diego State University -- This page last updated 16-Dec-98 |
<APPLET archive="AppletClasses.jar" code="BasicMethodsApplet.class" width=300 height=200> Your browser does not support Java applets, so you can not see this applet operate. </APPLET><BR>
import java.awt.*; import java.applet.Applet; public class BasicMethodsApplet extends Applet { TextArea messages = new TextArea(8, 30); public BasicMethodsApplet() { messages.append( "Constructor called\n" ); } public void init() { add( messages ); messages.append( "Init called\n" ); } public void start() { messages.append( "Start called\n" ); } public void stop() { messages.append( "Stop called\n" ); } public void destroy() { messages.append( "Destroy called\n" ); } public void paint( Graphics display ) { messages.append( "Paint called\n" ); // Draw border Dimension size = getSize(); display.drawRect( 0, 0, size.width-1, size.height-1); } }