Introduction
Lab Exercise 12 introduces students to graphical user interfaces. After completing this exercise students should be able to:
? create a simple graphical user interface in java
? use layout managers to arrange user-interface components in a container
? use several common user-interface components, such as radio buttons, combo boxes, and text fieldsin a GUI program
? handle events from user-interface components
Getting Started
Create a Java project in your Eclipse workspace called Lab12. There are several programs in this programming assignment. Each program will have one or more java files that you will create. Create these java files under the Lab12project source folder (called src by default) in your Eclipse workspace.
What to submit
When you have completed all of the programs in this assignment you will create a single zip file that includes your source code for each program. The zip file should only include the .java files. Archive files in any other format (rar for example) will not be accepted. You should submit the following files:
· Exercise 1
HelloWorldFrame.java
HelloWorldApp.java
· Exercise 2
InvestmentFrame.java
InvestmentApp.java
Exercise 1: Hello World
Write a GUI application that prints out "Hello!" in either: English, French, or Spanish. When the user selects another language, the greeting shown in the greeting area should change.Your GUI should look like the interface shown below:
it would be French= "Bonjour!", English="Hello!", and Spanish="Hola!"
You should submit two classes for this exercise:
? HelloWorldFrame
? HelloWorldApp
The HelloWorldFrame should extend JFrame and include the GUI code. The HelloWorldApp should include a main method that creates a HelloWorldFrameand displays it.
Exercise 2: Investment Calculator
Create the following GUI that allows a user to calculate the value of an investment after a certain number of years with monthly compound interest.
The GUI should allow the user to enter the initial amount of the investment, the number of years (displayed as a drop down list with a choice of 5, 15, or 30 years), and the annual interest rate. The future value is calculated with the following formula:
Here is an example showing how to use the future value equation:
? Investment amount = 10000
? Number of Years = 5
? Annual Interest Rate = 3%
You should submit two classes for this exercise:
? InvestmentFrame
? InvestmentApp
The InvestmentFrame should extend JFrame and include the GUI code. The InvestmentAppshould include a main method that creates anInvestmentFrameand displays it.