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.
SOLUTION
//CODE
import java.applet.Applet;
import java.awt.*;
public class MyApplet extends Applet {
Font f1;
public void init()
{
f1 = new Font("Arial",Font.BOLD,24);
}
public void paint(Graphics g)
{
g.setColor(Color.YELLOW);
g.fillOval(10, 10, 100, 100);
g.setColor(Color.BLACK);
g.setFont(f1);
g.drawString("Go", 42, 65);
}
}
//SAMPLE
Get Answers For Free
Most questions answered within 1 hours.