Graphics 2 Draw Rectangles


import java.awt.*; 
import java.applet.*;
/*
< applet code = "Graphics2" width = 300 height=200 >
< /applet>
*/
public class Graphics2 extends Applet
{
    public void paint (Graphics g)
    {
        g.drawRect (10 , 10 , 60 , 50);
        g.fillRect (100 , 10 , 60 , 50 );
        g.drawRoundRect (190 , 10 , 60 , 50 , 15 ,15);
        g.fillRoundRect ( 70 , 90 , 140 , 100 , 30, 40);
    }
}
    
        
    

Output: