home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Graphics;
-
- public class HelloAuto extends Applet {
- private int m_nInitCnt = 0;
- private int m_nStartCnt = 0;
- private int m_nStopCnt = 0;
- private int m_nDestroyCnt = 0;
-
- public void start() {
- ++this.m_nStartCnt;
- }
-
- public void stop() {
- ++this.m_nStopCnt;
- }
-
- public String getAppletInfo() {
- return "Name: HelloAuto\r\n" + "Author: Stephen R. Davis\r\n" + "Created for Learn Java Now (c)";
- }
-
- public void destroy() {
- ++this.m_nDestroyCnt;
- }
-
- public void init() {
- ((Applet)this).resize(320, 240);
- ++this.m_nInitCnt;
- }
-
- public void paint(Graphics g) {
- g.drawString("Hello, world", 0, 10);
- g.drawString("Init count = " + this.m_nInitCnt, 0, 20);
- g.drawString("Start count = " + this.m_nStartCnt, 0, 30);
- g.drawString("Stop count = " + this.m_nStopCnt, 0, 40);
- g.drawString("Destroy count = " + this.m_nDestroyCnt, 0, 50);
- }
- }
-