Share
Explore BrainMass

Java program to display and hide country flags

Program starts with an empty flag and none of the country buttons checked. When you select a country radio button, corresponding country's flag is displayed instead of empty flag.

Please see detailed question below.

Write an application with the GUI as shown in attachment p9.png .

Scenarios:
a. If user clicks any of the Radio Buttons, a flag of that country should appear in place of the "empty flag" icon.
b. If the button clicked,
i. Change text on button to "Show" <-> "Hide".
ii. Show/Hide the flag.

Attachments

Solution Preview

Java version "1.7.0_21" was used during development and testing of the attached solution.

Please rename attached 564997-Flags.java as Flags.java before you compile and execute it.

If you are compiling and executing the attached program at command line, you can follow these steps.

1. Place Bahrain_flag.jpg, Empty_flag.jpg, KSA_flag.jpg and Kuwait_flag.jpg in same folder as Flags.java .

You already have the icons of the images attached to your question. Just ...

Solution Summary

Program starts with an empty flag and none of the country buttons checked. When you select a country radio button, corresponding country's flag is displayed instead of empty flag.

Java version "1.7.0_21" was used during development and testing of the attached solution.

$2.19