Java examples for 2D Graphics:Rectangle
Fill Rectangle & Square
import java.applet.Applet; import java.awt.Color; import java.awt.Graphics; public class Main { public void paint(Graphics g){ g.fillRect(10,10,50,100); g.fillRect(100,100,50,50); }//from w w w . ja va2 s .c om }