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.
Code to be written in .java file:
import java.awt.*;
import java.applet.*;
public class circle extend Applet
{
Font f;
public void init()
{
f = new Font("Arial",Font.BOLD,24);
}
public void paint(Graphics g)
{
g.setColor(Color.yellow);
g.fillOval(70,30,100,100);
g.setFont(f);
g.setColor(Color.black);
g.drawString("GO",70, 30);
}
}
Code to be written in .HTML file:
<html>
<head>
</head>
<body>
<applet code = "circle.class" width = "600" height = "400"></applet>
</body>
</html>
Get Answers For Free
Most questions answered within 1 hours.