Draw Rectangle in Applet – Java Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
/* <applet code="DrawRectanglesExample" width=200 height=200> </applet> */ import java.applet.Applet; import java.awt.Graphics; public class DrawRectanglesExample extends Applet { public void paint(Graphics g) { //this will draw a rectangle of width 50 & height 100 at (10,10) g.drawRect(10,10,50,100); //this will draw a square g.drawRect(100,100,50,50); } } |