ALGORITHM FOR APPLET GRAPHICS:
Step1: Start the Program.
Step2: Import Applet package to the Program.
Step3: Create a new Class called Myapplet.
Step4: Draw a line using drawLine method,pass the points as an argument.
Step5: Draw a rectangle using drawRect method,pass the points as an argument.
Step6: Draw a oval using drawOval method,pass the points as an argument.
Step7: Using fillRect method,fill the rectangle.
Step8: Using fillOval method,fill the Oval.
Step9: Stop the program.
PROGRAM CODE:
importjava.awt.*;
importjava.applet.*;
/*
<applet code="Grap" width=500
height=300>
</applet>
*/
public class Grap extends Applet
{
public void paint(Graphics g)
{
g.drawLine(0,0,200,100);
g.drawRect(10,10,80,100);
g.fillRect(100,10,80,100);
g.drawOval(300,10,100,100);
g.drawOval(250,100,100,200);
g.fillOval(30,200,200,100);
}
}
0 comments:
Post a Comment