drawRect() fillRect() Example
For the drawRect() and fillRect() methods the first two parameters are the x, y top-left coordinates of the rectangle.The last two parameters are the width and height of the rectangle.
// drawRect() fillRect() Example
import java.awt.*;
import javax.swing.*;
class DrawRectExample extends JApplet {
@Override public void paint(Graphics g) {
super.paint(g);
g.drawRect(50,100,75,120);
g.fillRect(150,75,100,175);
}
}
