Draw Rectangle in java Applet

Hello Friends, 

Today I will explain how can we draw Rectangle in java applet.
In this  program I have print simple Rectangle but you can draw different shapes with different size.
    import java.awt.*;
import java.applet.*;
import java.awt.event.*;

/*


*/

public class twelve extends Applet
{
public void paint(Graphics g)
{
g.drawRect(20,200,60,50);

setForeground(Color.red);
g.fillRect(70,400,80,30);

}
}

Leave a Reply

Your email address will not be published. Required fields are marked *