Example of filled
rectangle primitive
Consider the rectangle displayed by this
applet:
The code for this applet is as follows:
import
java.applet.Applet;
import java.awt.*;
public class FillRect1 extends Applet
{
public void paint( Graphics g )
{
int xPos = 50;
int yPos = 50;
int w = 100; //
width
int h = 20; //
height
g.setColor(
Color.red );
g.fillRect( xPos,
yPos, w, h);
}
} // class
As can be seen a fillRect() message was sent to
the Graphics object g.
Back
to top

RITSEC - Global Campus
Copyright ?1999 RITSEC- Middlesex University. All rights reserved.
webmaster@globalcampus.com.eg
|