Before doing the Java Beans, you should know much about the Java. Hope that you know enough so that you can go for the beans. The following code will help you to write the code for the beans which is much simple :
Code:
import java.awt.Color;
import java.beans.XMLDecoder;
import javax.swing.JLabel;
import java.io.Serializable;
public class BeanDemo extends JLabel
implements Serializable {
public BeanDemo() {
setText( "Hello world!" );
setOpaque( true );
setBackground( Color.BLUE );
setForeground( Color.RED );
setVerticalAlignment( CENTER );
setHorizontalAlignment( CENTER );
}
}
Bookmarks