Search your topic here

Graphics in Applet

APPLET GRAPHICS:


import java.applet.Applet;
import java.awt.*;
public class Graphic extends Applet{
public void paint(Graphics g){
g.setColor(Color.yellow);
g.fillRect(0,0,200,30);
g.setColor(Color.black);
g.drawString("Namashkar",50, 50);
g.setColor(Color.red);
g.drawLine(200,30,200,300);
g.setColor(Color.green);
g.drawOval(0,100,200,30);
g.setColor(Color.gray);
g.drawArc(60,150,30,30,30,360);
g.setColor(Color.cyan);
g.fillArc(0,150,30,30,0,360);
g.setColor(Color.magenta);
g.fillArc(0,150,30,30,0,180);
g.setColor(Color.ORANGE);
g.fillArc(0,150,30,30,0,90);
g.setColor(Color.LIGHT_GRAY);
g.fillArc(30,150,30,30,0,360);
g.fill3DRect(0, 200, 100, 100, true);
}
}


OUTPUT:



TO EXECUTE APPLET IN WEB BROWSER:


Type this code in text editor, and save as HTML file, then open that HTML file in browser.



OUTPUT:


LEAVE A REPLY










Related topics

Please use contact page in this website if you find anything incorrect or you want to share more information about the topic discussed above.