Hai all,
I have just started to learn Java beans . Actually I am not able to understand its basics. I searched in net and found many tutorials but not able to capture the starting point. I got the following code from net and when I tried to run it it showed an information box "The bean does not have a main method". When I added a main() methode to it it is running but not executing the paint method so nothing is displayed in the output! Can anyone help me?

import java.awt.*;
import java.io.Serializable;

public class SimpleBean extends Canvas
implements Serializable{

private Color color = Color.green;

//property getter method
public Color getColor(){
return color;

//property setter method. Sets new SimpleBean
//color and repaints.
public void setColor(Color newColor){
color = newColor;

public void paint(Graphics g) {
g.fillRect(20, 5, 20, 30);

//Constructor sets inherited properties
public SimpleBean(){

Also if anyone knows a site for learning Java beans programming in simple steps please let me know.
Thanks in advance,