please include comments //. thenk you. PLEASE DONT FORGET TO DRAW THE BAD GUY AT
ID: 3715364 • Letter: P
Question
please include comments //. thenk you. PLEASE DONT FORGET TO DRAW THE BAD GUY AT THE END TOO, INSTRUCTIONS ARE ON THE BOTTOM. I APPRECIATE YOUR HELP!!!
Objective
To practice drawing with Java graphics.
Overview & Instructions
Build a Java application to draw the following four graphic objects in the application window. Utilize a simple user interface that allows the user to select one or more of the objects to view or hide.
A smiley face
Draw a house and a pine tree.
Create a new color to make the brown tree trunk. Try various RGB patterns to find brown.
Design and draw a personal logo. Use your initials, or some image that depicts you.
Include the use of font control for text sizing.
Finally, if you were tasked with implementing a battle game as an applet, draw an image of a bad guy, an enemy fighter, or some other sinister image. (Just one image)
?
A smiley face
Draw a house and a pine tree.
Create a new color to make the brown tree trunk. Try various RGB patterns to find brown.
Design and draw a personal logo. Use your initials, or some image that depicts you.
Include the use of font control for text sizing.
Finally, if you were tasked with implementing a battle game as an applet, draw an image of a bad guy, an enemy fighter, or some other sinister image. (Just one image)
?
Explanation / Answer
For smiley you could use this :
// Applet program to draw Smily Human-Faceimport java.awt.*;
import java.applet.*;
/*<applet code=face width=400 height=350></applet>*/
public class face extends Applet
{
public void paint(Graphics g)
{
setBackground(Color.yellow);
g.setFont(new Font("TIMES NEW ROMAN",2,40));
g.drawString("Smile Please..!",60,50);
g.setColor(Color.magenta);
g.fillOval(90, 80, 200, 200);
g.setColor(Color.black);
g.fillOval(130, 120, 45, 45);
g.fillOval(210, 120, 45, 45);
g.drawLine(190, 170, 190, 210);
g.fillArc(160, 200, 60, 50, 0, -180);
g.drawArc(123, 100, 60, 60, 0, 180);
g.drawArc(200, 100, 60, 60, 0, 180);
g.setColor(Color.blue);
g.fillOval(135, 123, 30, 30);
g.fillOval(215, 123, 30, 30);
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.