import java.awt.*;

import java.applet.*;

 

 

public class Applet1 extends Applet

{

Button boton=new Button("prueba");

Label etiqueta=new Label("Fondo del Applet");

Button rojo=new Button("rojo");                                                             

Button azul=new Button("azul"); 

Button negro=new Button("negro");          

TextField caja=new TextField(20);

           

            public void init()

            {

                        setBackground(Color.blue);

                        setForeground(Color.yellow);

                        add(boton);add(etiqueta);

                        add(rojo);add(azul);

                        add(negro);add(caja);

                                                                                                 

            }

                        public boolean action(Event e,Object o)

                        {

                                    if(o.equals("prueba"))

                                    {            boton.setLabel("boton");

                                                etiqueta.setText(caja.getText()); }

                                    if(o.equals("boton"))

                                    {            boton.setLabel("prueba");

                                                etiqueta.setText(caja.getText()); }

                                     if(o.equals("rojo"))

                                     { setBackground(Color.red);etiqueta.setBackground(Color.red);}

                                                                                                                                                                                      

                                                                                                                                   

                                     if(o.equals("azul"))

                                     { setBackground(Color.blue);etiqueta.setBackground(Color.blue);}

                                                                                                                                                              

                                     if(o.equals("negro"))

                                     {setBackground(Color.black);etiqueta.setBackground(Color.black);}

                                                                                                                                                                                               

                                                                                                                                     

                                                                                       return true;

                                               

                        }

}