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.
Answer:
Given that
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.
Program:
Java Code:
import java.applet.Applet;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
public class Test extends Applet{
@Override
public void paint(Graphics g) {
//setting the circle
setForeground(Color.yellow);
g.fillOval(50, 50, 100, 100);
//setting the text
g.setColor(Color.red);
g.setFont(new Font("Arial", Font.Bold, 24));
g.drawString("Go", 85, 110);
}
}
Output:
Get Answers For Free
Most questions answered within 1 hours.