JAVA GUI Prog7.java with detailed comments

Download Full Answer : click HERE

JAVA - GUI

Prog7.java

Write a program that tests the user’s ability to memorize a sequence of colors. As shown in the sample session, the program starts off by displaying a dialog box with a list of colors that are to be memorized – red, white, yellow, green, and blue. The user then enters the colors one at a time in a text box. If the user makes a mistake, the program prints a “Sorry” message. If the user correctly enters all the colors, the program prints a “Congratulations” message. Note that when the sorry or congratulations message is printed, the window’s original components get cleared away.

As always, you are required to write elegant code. In particular, you should avoid hard coding the color values in the interior of your program. You should declare those values one time in an array at the top of the program.

Note:

· Your program should contain a class named Prog7.

· Use a simple FlowLayout layout manager scheme.

· Use an inner class for the listener.



As always:

· Limit your use of class variables and instance variables – use them only if appropriate.

· Use appropriate modifiers for your methods. The modifiers we’ve discussed are private, public, static, and final.

· Use helping methods if appropriate.

· Mimic the sample session precisely. In particular, note the dialog box’s text, the window’s title, and the window’s text.

sample:

The opening dialog box:

Message

How good is your memory?
Try to memorize this color sequence:
red white yellow green blue

ok

After closing the dialog box, here's the main window:

Memory Game

Enter color number 1: red

After pressing enter and then typing the second color:

Memory Game
Enter color number 2: white

After entering all five colors correctly:
Memory Game

Congratulations- your memory is perfect!


Second sample session:

After closing the dialog box and typing the first color:
Memory Game

Enter Color number 1: red

After pressing enter and then typing the second color:
Memory Game

Enter color number 2: black

After pressing enter:

Memory Game

Sorry-wrong color. Eat more antioxidants.JAVA - GUI

Prog7.java

Write a program that tests the user’s ability to memorize a sequence of colors. As shown in the sample session, the program starts off by displaying a dialog box with a list of colors that are to be memorized – red, white, yellow, green, and blue. The user then enters the colors one at a time in a text box. If the user makes a mistake, the program prints a “Sorry” message. If the user correctly enters all the colors, the program prints a “Congratulations” message. Note that when the sorry or congratulations message is printed, the window’s original components get cleared away.

As always, you are required to write elegant code. In particular, you should avoid hard coding the color values in the interior of your program. You should declare those values one time in an array at the top of the program.

Note:

· Your program should contain a class named Prog7.

· Use a simple FlowLayout layout manager scheme.

· Use an inner class for the listener.



As always:

· Limit your use of class variables and instance variables – use them only if appropriate.

· Use appropriate modifiers for your methods. The modifiers we’ve discussed are private, public, static, and final.

· Use helping methods if appropriate.

· Mimic the sample session precisely. In particular, note the dialog box’s text, the window’s title, and the window’s text.

sample:

The opening dialog box:

Message

How good is your memory?
Try to memorize this color sequence:
red white yellow green blue

ok

After closing the dialog box, here's the main window:

Memory Game

Enter color number 1: red

After pressing enter and then typing the second color:

Memory Game
Enter color number 2: white

After entering all five colors correctly:
Memory Game

Congratulations- your memory is perfect!


Second sample session:

After closing the dialog box and typing the first color:
Memory Game

Enter Color number 1: red

After pressing enter and then typing the second color:
Memory Game

Enter color number 2: black

After pressing enter:

Memory Game

Sorry-wrong color. Eat more antioxidants.
Download Full Answer : click HERE

TYPE SOME PART OF QUESTION YOU ARE LOOKING FOR

.

.
acc week