Various Shapes

import java.awt.*;
import java.applet.*;
/*<applet 
    code=shapes.class width=300 height=300>
</applet>*/
public class shapes extends Applet
{
 public void init()
 {
  setBackground(Color.pink);
 }
 public void paint(Graphics g)
 {
  g.drawString("Various Shapes",100,50);
  g.drawLine(10,10,50,50);
  g.drawRect(10,60,40,30);
  g.setColor(Color.yellow);
  g.fillRect(50,40,70,80);
  g.drawRoundRect(70,70,60,90,10,10);
  g.setColor(Color.blue);
  g.fillRoundRect(70,70,60,90,10,10);
  g.fillArc(150,160,100,120,0,180);
  int x[]={20,120,220,20};
  int y[]={120,20,220,120};
  int n=x.length;
  g.drawPolygon(x,y,n);
 }
} 

No comments:

Post a Comment