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 |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started