Sunday, 10 September 2017

Graphics program

import java.applet.*;
import java.awt.*;
/*<applet code=graph height=500 width=500></applet>*/
public class graph extends Applet
{
  String s;
  int xs[]={40,49,60,70,57,40,55};
  int ys[]={370,340,385,360,350,300,350};
  public void init()
  { 
setForeground(Color.red);//method of Component class
  }
  public void paint(Graphics g)
  {
    g.drawLine(50,70,120,70);
   g.drawRect(50,100,70,40);
    g.fillRect(140,100,40,40);     g.drawRoundRect(230,100,70,40,20,20);       g.fillRoundRect(320,100,70,40,20,20);
    g.drawOval(140,180,70,30);
    g.fillOval(230,180,70,70);
     g.drawArc(100,270,70,70,0,90);    
     g.fillArc(200,270,70,40,0,-120);
     g.drawPolygon(xs,ys,4);
  }
}   

No comments:

Post a Comment

Featured post

Development Of JAVA Program