import java.awt.*; 
import java.io.Serializable; 
public class CustomBean extends Canvas implements Serializable 
{ 
//¶¨Òå¼òµ¥ÊôÐÔ	
private Color color=Color.red;

//Constructor sets inherited properties 
public CustomBean() 
{ 
setSize(100,100); 
setBackground(color); 
} 
public Color getColor()
{
	return color;
}
public void setColor(Color c)
{
	color=c;
	repaint();
}
    public void paint(Graphics g) 
{
	setBackground(color);
	String tempColor="red";
	if(color==Color.red)
		tempColor="red";
	else if(color==Color.green)
		tempColor="green";
	Font f1 = new Font("Monospaced",Font.BOLD,50);
	g.setFont(f1);
	g.drawString("I am "+tempColor+"!",0,100);
}
} 
