Question: Write a program that that displays a dialog box show a message and a randomly chosen color. This random color is to be used as

Write a program that that displays a dialog box show a message and a randomly chosen color.

This random color is to be used as the background color of a JFrame window which should appear after OK is selected. The window should ask your name and thank you for playing once Enter is pressed.

See sample output below.

LnFnUnit7.java

Utilize showMessageDialog to output the message shown in the sample at the bottom. A random color should be output with each run

Upon clicking OK

Create a JFrame window o Set the background and label text color as shown in sample below o Include a label asking to enter name (see sample) o Include a textfield to get input for name (see sample)

o Upon hitting Enter on the keyboard, output thank you message to include the name entered as per sample at bottom

Use an inner class for the listener

Mimic the same session precisely. Pay attention to colors of the window and label.

Sample

Your output will vary based on the random color generated.

Initial dialog box

 Write a program that that displays a dialog box show a

message and a randomly chosen color. This random color is to be

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 Databases Questions!