In: Computer Science
Write an applet in Java that creates a yellow colored filled circle on screen. Inside this circle the word “GO” with Arial font and size 24, bold face needs to be printed. Justify your syntax.
import java.applet.*; //importing applet header file
import java.awt.*;
public class abc extends Applet { // extending applet class
public void paint(Graphics x)
{
x.drawOval(50, 50, 400, 400); //this will make oval at the given coordinate(x-axis,y-axis,width,height)
x.setColor(Color.yellow); //this will set the color as yellow
x.fillOval(50, 50, 400, 400); //this will fill the circle in yellow color
Font f=new Font("Arial",Font.BOLD,24); //Changing the font style
x.setFont(f); //setting font
x.setColor(Color.red); // i am changing the font color as red
x.drawString("Go", 240, 240); //this will draw a string and setting it in the coordinate x and y axis
}
}