Develop a program to draw any one of the following: a) Square inside a circle b) Circle inside a square
a.
Square inside a circle
/*<applet code="Square.class"
width=300 height=300>
</applet>
*/
import java.applet.*;
import java.awt.*;
public class Square extends Applet
{
public void paint(Graphics g)
{
g.drawString("Square inside a
circle",150,115);
g.drawOval(180,10,80,80);
g.drawRect(192,22,55,55);
}
}
b. Circle inside a square
/*<applet code="Circle.class" width=300 height=300>
</applet>
*/
import java.applet.*;
import java.awt.*;
public class Circle extends Applet
{
public void paint(Graphics g)
g.drawString("Circle inside a square",65,115);
g.drawRect(80,10,80,80);
g.drawOval(80,10,80,80);
}
}
Comments
Post a Comment