home *** CD-ROM | disk | FTP | other *** search
- <!--NewPage-->
- <html>
- <head>
- <title>Simple.java</title>
- </head>
- <body>
- <p>
- <hr size=4>
-
- <h2>
- Simple.java
- </h2>
- <p>
- <blockquote>
-
- <pre>
-
- /*
- * Copyright (c) 1994 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Permission to use, copy, modify, and distribute this software
- * and its documentation for NON-COMMERCIAL purposes and without
- * fee is hereby granted provided that this copyright notice
- * appears in all copies. Please refer to the file "copyright.html"
- * for further important copyright and licensing information.
- *
- * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
- * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
- * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
- */
- import java.awt.Graphics;
-
- public class Simple extends java.applet.Applet {
-
- StringBuffer buffer = new StringBuffer();
-
- public void init() {
- resize(500, 20);
- addItem("initializing... ");
- }
-
- public void start() {
- addItem("starting... ");
- }
-
- public void stop() {
- addItem("stopping... ");
- }
-
- public void destroy() {
- addItem("preparing for unloading...");
- }
-
- public void addItem(String newWord) {
- System.out.println(newWord);
- buffer.append(newWord);
- repaint();
- }
-
- public void paint(Graphics g) {
- g.drawRect(0, 0, size().width - 1, size().height - 1);
- g.drawString(buffer.toString(), 5, 15);
- }
- }
- </pre>
- </blockquote>
- <p>
- <hr size=4>
- <p>
- </body>
- </html>
-