// import necessary packages import java.applet.*; import java.awt.*; import static java.lang.System.out; // Inherit the applet class from the class Applet public class test extends Applet { Button mybutton; int width, height; // Now you should implement the following methods // init - method is called the first time you enter the HTML site with the applet public void init() { setBackground(Color.blue); setForeground(Color.red); mybutton = new Button("woot"); add (mybutton); width = getSize().width; height = getSize().height; setBackground( Color.black ); } // start - method is called every time you enter the HTML - site with the applet public void start() { out.println ("hi"); } // stop - method is called if you leave the site with the applet public void stop() {} // destroy method is called if you leave the page finally (e. g. closing browser) public void destroy() {} public void paint (Graphics g) { g.setColor( Color.red ); g.drawLine( 50, 50, 100, 50 ); g.drawLine( 50, 55, 100, 55 ); g.drawLine( 50, 50, 50, 100 ); } }