Manu

Saturday, November 19, 2016

Write a program to working with Graphics Class.

Input :

package javaapplication2;
import java.applet.Applet;
import java.awt.Graphics;
public class StringApplet extends Applet {
      public void paint(Graphics g)
       {
  g.drawString("hello friends", 50, 50);
         g.drawLine(35, 50, 75, 95);
         g.drawRect(100, 100, 100, 100);
         g.drawRoundRect(210,100,  100,100, 10, 10);
         g.drawOval(340,100,100, 100);
         g.drawArc(450, 100, 75, 95, 0, 180);
  int []x = {60,35,50,65,80,95};
  int []y = {60,105,105,110,95,95};
 g.drawPolygon(x, y, 6);             
    }
}

Output :


No comments:

Post a Comment