/** * An applet to provide a simple editor of text. The text may * be saved to the server and got from the server. I would like * to display line numbers, use white on black, find and replace */ import java.applet.Applet; import java.awt.Graphics; import java.awt.Event; public class Editor extends Applet { StringBuffer buffer; public void init() { buffer = new StringBuffer(); addItem("initializing... "); } public void start() { addItem("starting... "); } public void stop() { addItem("stopping... "); } public void destroy() { addItem("preparing for unloading..."); } void addItem(String newWord) { System.out.println(newWord); buffer.append(newWord); repaint(); } public void paint(Graphics g) { //Draw a Rectangle around the applet's display area. g.drawRect(0, 0, size().width - 1, size().height - 1); //Draw the current string inside the rectangle. g.drawString(buffer.toString(), 5, 15); } public boolean mouseDown(Event event, int x, int y) { addItem("click!... "); return true; } } //-- applet