Basic HTML version of Foils prepared March 23 98

Foil 11 The rest of the HelloBean example

From JavaBeans and Use in ComponentWare Basic Information Track Computational Science Course CPS616 -- March 25 1998. by Nancy McCracken, Geoffrey C. Fox, Wojtek Furmanski


Additional methods make the bean have a visualization (canvas)
public Dimension getMinimumSize()
{ return new Dimension (250, 70); }
public void paint(Graphics g)
{Font f = new Font("TimesRoman", Font.BOLD, 36);
g.setFont(f);
g.setColor(Color.red);
g.drawString("Hello " + sname + "!", 5, 50);
}
}
Use the paint method to draw on the canvas
New JDK1.1 method to tell Layout manager the minimum size of the canvas - also defines a (read only) property.



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Nov 29 1998