/* A simple applet that sets the foreground and background colors and outputs a string. */ import java.awt.*; import java.applet.*; /* */ public class Sample extends Applet{ StringBuffer msg; // set the foreground and background colors. public void init() { msg = new StringBuffer(); setBackground(Color.cyan); setForeground(Color.red); msg.append("Inside init( ) --"); } // Initialize the string to be displayed. public void start() { msg.append(" Inside start( ) --"); } // Display msg in applet window. public void paint(Graphics g) { msg.append(" Inside paint( )."); g.drawString(msg.toString(), 10, 30); } }