// A trivial JavaBean, just a rectangle with a single Property // called "theColor". // // Written April 2000 by Wayne Pollock, Tampa Florida USA import java.awt.*; import java.io.*; public class SBean extends Canvas implements Serializable { private Color theColor; public SBean () { theColor = Color.white; setBackground( theColor ); } public Color gettheColor () { return theColor; } public void settheColor ( Color c ) { theColor = c; } public void paint ( Graphics g ) { g.setColor( theColor ); g.fillRect( 0, 0, getSize().width, getSize().height ); } public Dimension getPreferredSize () { return new Dimension( 50, 50 ); } public Dimension getMinimumSize () { return getPreferredSize(); } }
Send comments and mail to the WebMaster. |