Question: Building Java Programs Supplement 3 G . Design and implement your own GUI application, drawing a different image than the one shown at the end

Building Java Programs Supplement 3G.
Design and implement your own GUI application, drawing a different image than the one shown at the end of this page.
You can model your code like the following sample code, but make sure it is different in several ways (i.e. colors, dimensions, content).
This image includes 2 images, a sun and a snowman. Add at least one new object to the GUI.
Add text to the top with a title above the head of the snowman in this case (not the title bar).(D) Snowman.java
```
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.*;
public class Snowman extends JPanel // Draws a snowman to demonstrate drawing methods and use of color.
6
public void paintComponent (Graphics page)// @param page object on which drawing takes place
{
final int MID =150;
final int TOP =50;
page.setColor(Color.CYAN);
page.fillRect(0,0, getWidth(), getHeight());
Color groundColor = new Color(127,0,64);
page.setColor (groundColor);
page.fillRect (0,175,300,50); // ground
page.setColor (Color.yellow);
page.fillOval (-40,-40,80,80); // sun
page.setColor (Color.white);
page.fillOval (MID -20, TOP, 40,40); // head
page.fillOval (MID -35, TOP +35,70,50); // upper torso.
page.fillOval (MID -50, TOP +80,100,60); // lower torso
page.setColor (Color.black);
page.fillOval (MID -10, TOP +10,5,5); // left eye
page.fillOval (MID +5, TOP +10,5,5); // right eye
page.drawArc (MID -10, TOP +20,20,10,190,160); // smile
page.drawLine (MID -25, TOP +60, MID -50, TOP +40); // left arm
page.drawLine (MID +25, TOP +60, MID +55, TOP +60); // right arm
page.drawLine (MID -20, TOP +5, MID +20, TOP +5); // brim of hat
page.fillRect (MID -15, TOP -20,30,25); // top of hat
}
public Snowman()// Constructor (panel initialization)
{
setPreferredSize(new Dimension(300,200));
}
public static void main (String[] args)// Starting point for Snowman application.
{
JFrame frame = new JFrame ("Snowman");
frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(new Snowman());
frame.pack();
frame.setVisible(true);
}
}
```
Building Java Programs Supplement 3 G . Design

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!