Question: Run the following program: Modify the program as follows: Double the frame size. Change the greeting to Hello, your name!. Change the

Run the following program:

import java.awt.Color; import javax.swing.JFrame; import javax.swing.JLabel; public class FrameViewer { } public

Modify the program as follows:
• Double the frame size.
• Change the greeting to “Hello, your name!”.
• Change the background color to pale green (see Exercise •• Graphics E2.11).
• For extra credit, add an image of yourself. (Construct an Image Icon.)

Data from graphics E2.11

Repeat Exercise •• E2.10 but place your code into the following class. Then the
color will be displayed.

static void main(String[] args) { JFrame frame = new JFrame(); frame.setSize(200, 200);

JLabel label= new JLabel("Hello, World!"); label.setOpaque(true); label.setBackground (Color.PINK); frame.add(label); frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); frame.setVisible(true);

import java.awt.Color; import javax.swing.JFrame; import javax.swing.JLabel; public class FrameViewer { } public static void main(String[] args) { JFrame frame = new JFrame(); frame.setSize(200, 200); JLabel label= new JLabel("Hello, World!"); label.setOpaque(true); label.setBackground (Color.PINK); frame.add(label); frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); frame.setVisible(true);

Step by Step Solution

3.44 Rating (151 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Based on the instructions and the code provided in the images I will guide you through modifying the code according to the specified changes 1 Double ... View full answer

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 Java Programming Questions!