import java.awt.event.*;
import java.awt.*;
import java.applet.*;


public class BeanTest extends Applet implements MouseListener{
	CustomBean cBean;
	Button b;
    
    public void init() {
	setLayout(new BorderLayout());
	cBean = new CustomBean();
        b = new Button("color");
        b.addMouseListener(this);
	add("Center", cBean);
	add("South",b);
    }

    public void destroy() {
        remove(cBean);
        remove(b);
    }

    public void mousePressed(MouseEvent e) {
        e.consume();
        if(cBean.getColor()==Color.red)
        cBean.setColor(Color.green);
        else
        cBean.setColor(Color.red);
   }

    public void mouseReleased(MouseEvent e) {
    }

    public void mouseEntered(MouseEvent e) {
    }

    public void mouseExited(MouseEvent e) {
    }

    public void mouseClicked(MouseEvent e) {
    }

    public static void main(String args[]) {
	Frame f = new Frame("BeanTest");
	BeanTest bTest = new BeanTest();
	bTest.init();
	bTest.start();

	f.add("Center", bTest);
	f.setSize(300, 300);
	f.show();
    }
    public String getAppletInfo() {
        return "A simple bean test program.";
    }
}