Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions