Write a program to create an applet for displaying circle, rectangle and triangle one below the other and filled them with red, green and yellow respectively in java

import java.awt.*;
import java.applet.*;
/* <applet code="Some" width=200 height=200>
</applet> */
public class Some extends Applet
{
public void paint(Graphics g)
{
g.setColor(Color.RED);
g.fillOval(80,50,50,50);
g.setColor(Color.GREEN);
g.fillRect(50,120,100,50);
g.setColor(Color.YELLOW);
int x1[]={50, 100, 150, 50};
int y1[]={250, 200, 250, 250};
int n1=4;
g.fillPolygon(x1, y1, n1);
}
}

Output:

Comments