import java.awt. *; public class Hwa3 extends java.applet.Applet { private Font newfont; // these variables need to be accessed from TextMove and so // must be public public int xsize, ysize, xcoord = 60; // determine size of applet, create buttons and fonts public void init () { xsize = this.size ().width; ysize = this.size ().height; newfont = new Font ("TimesRoman", Font.ITALIC, 30); } // paint method handles drawing public void paint (Graphics g) { // always draw yellow box g.setColor (Color.yellow); g.fillRect (50, 50, xsize - 100, ysize - 100); // if button is on draw text also if (onbutton) { g.setFont (newfont); g.setColor (Color.red); g.drawString ("Hello World!", xcoord, ysize / 2); } } // this method handles user interaction via the button public boolean action (Event evt, Object arg) { // needs code to be plugged in here } }