Question

In: Computer Science

Write an applet in Java that creates a yellow colored filled circle on screen. Inside this...

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 within 25 min plzzz

Solutions

Expert Solution

JAVA PROGRAM

import java.applet.*;
import java.awt.*;
// html applet code call "circleColor.class" with size of window
// width=250 and height=250
/*<applet code=circleColor.class width=250 height=250>
</applet>*/

// create class circleColor
// inherites Applet class
public class circleColor extends Applet
{
// create method paint()
public void paint(Graphics g)
{
// set color yellow using Color class using setColor() method
g.setColor(Color.yellow);
/* create circle using fillOval() method
fillOval() syntax fillOval(int x,int y,int width,int height)
here x-left edge of the circle
y-top edge of the circle
width and height - these two parameters are radius of circle
Note: you should give same size of width and height
*/
g.fillOval(0,50,200,200);
// again set color red for font using setColor() method
g.setColor(Color.red);
/* create Font object "fnt" with set some parameters
using Font class constructor with parameters
first parameter String name of the font
second parameter is int style (BOLD,ITALIC etc.,)
third parameter is int size
After creation of object using this object into setFont() method
*/

Font fnt=new Font("Arial",Font.BOLD,24);
g.setFont(fnt); // calling Font object "fnt"
/* write some text like "GO" using drawString() method
with 3 parameters
First parameter is String to write any string
second and third parameter x and y is coordinates on the
circle object
*/
g.drawString("GO",85,155);
}
}

PROGRAM SCREESHOTS

OUTPUT:

D:\>javac circleColor.java
D:\>appletviewer circleColor.java


Related Solutions

Write an applet in Java that creates a yellow colored filled circle on screen. Inside this...
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. I need this answer ASAP PLZ.
Write an applet in Java that creates a yellow colored filled circle on screen. Inside this...
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.
Write an applet in Java that creates a yellow colored filled circle on screen. Inside this...
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
Write an applet in Java that creates a yellow colored filled circle on screen. Inside this...
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.  
Write an applet in Java that creates a yellow colored filled circle on screen. Inside this...
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.  
Write an applet in Java that creates a yellow colored filled circle on screen. Inside this...
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.
Write an applet in Java that creates a yellow colored filled circle on screen. Inside this...
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.
Write an applet in Java that creates a yellow colored filled circle on screen. Inside this...
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
Write an applet in Java that creates a yellow colored filled circle on screen. Inside this...
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.
Write an applet in Java that creates a yellow colored filled circle on screen. Inside this...
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.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT