import java.applet.Applet; import java.awt.Graphics; import java.awt.Color; import java.awt.Font; public class afg extends Applet { /** * Initializes the applet. You never need to call this directly; it is * called automatically by the system once the applet is created. */ int estado = 1; Color red = new Color(190,20,80); Font f1 = new Font ("Dialog", Font.BOLD, 20); int[] puntosX = {60, 90, 150, 180}; int[] puntosY = {136, 90, 90, 136}; public void paint (Graphics g){ if (estado==1) {g.setFont(f1); g.drawString ("hola", 7,20); g.setColor (red); g.fillRect (20, 136, 200, 60); g.setColor (Color.blue); g.fillPolygon (puntosX, puntosY, 4); g.setColor (Color.white); g.fillOval (40, 200, 40, 40); g.fillOval (170, 200, 40, 40); } else if (estado==2) {g.setFont(f1); g.drawString ("hola", 7,20); g.setColor (red); g.fillRect (20, 40, 100, 100); g.setColor (Color.red); g.fillPolygon (puntosX, puntosY, 5); g.setColor (Color.black); g.fillOval (40, 200, 40, 40); } } public void init() { } /** * Called to start the applet. You never need to call this directly; it * is called when the applet's document is visited. */ public void start() { } /** * Called to stop the applet. This is called when the applet's document is * no longer on the screen. It is guarenteed to be called before destroy() * is called. You never need to call this method directly */ public void stop() { } /** * Cleans up whatever resources are being held. If the applet is active * it is stopped. */ public void destroy() { } }