package programacion; import java.awt.*; public class tareapplet extends java.applet.

Applet { Frame window; Button abrir, cerrar, rojo, azul, verde, blanco, negro; Button cerrarapp;

public void init() { abrir= new Button ("Abrir ventana"); add(abrir); cerrar=new Button ("Cerrar ventana"); add(cerrar);

window=new BaseFramel("Ventana"); window.resize(500,200);

setBackground(Color.white); setLayout(new FlowLayout (FlowLayout.CENTER,10,10));

rojo= new Button("Rojo"); add(rojo); azul= new Button("Azul"); add(azul); verde= new Button("Verde"); add(verde); blanco= new Button("Blanco");

hide().equals("Cerrar app")){ System. if (Label.isShowing()) window.show(). } public boolean action(Event evt. add(negro).exit(0). } if (Label. add(cerrarapp). } if (Label.equals("Cerrar ventana")){ if (window. Object arg) { if (evt.equals("Abrir ventana")) { if (!window.target instanceof Button) { String Label= (String)arg. cerrarapp= new Button ("Cerrar app").add(blanco).isShowing()) window. } . negro= new Button("Negro"). changeColor ((Button)evt.target).

setFont(new Font ("Arial".0). else if (p==blanco) setBackground (Color.red). } public Insets getInsets() { return new Insets(20. l= new Label(message. else if (p==azul) setBackground (Color.return true.white). } class BaseFramel extends Frame { String message= "Alo! ca va?".0. 12)).25. add ("Center". } } void changeColor(Button p){ if (p==rojo) setBackground (Color. l. else if (p==verde) setBackground (Color.blue). .l). } else return false.PLAIN. Font. Label.green). setLayout(new BorderLayout()).CENTER). BaseFramel (String title) { super (title). Label l.

} } .black). repaint().else if (p==negro) setBackground (Color.