[an error occurred while processing this directive]
Domain for sale!
Start Search Contents Index Links About

Exchange rate calculator - Part 2/2

GUI

2001 - Week 49 - Havard Rast Blok

This week you will make GUI for the calculator and finally combine it with the back end exchange rate retriever. You may choose whether you use AWT or Swing components, both should be possible. However I will use Swing in my suggestions.

Please note that Aftenposten is a registered trademark and that this program is for educational purposes only.

First you need to look at some GUI components and how they behave. You need a JTextField and a JComboBox. Make small GUI application which lists your favorite artists or authors in the drop down list and displays the name you select in the JTextField.


TestGUI.java

Now you will combine the exchange rate reader from last week with a GUI shown bellow. Here is how it should work: You select the currency from the JComboBox. When you type the amount in the JTextField for your local currency, its value in the foreign currency is shown bellow, and vice versa.

Hint: JTextField.addKeyListener(...) and KeyListener.


ExchangeRateCalculator.java

If you did not make a real time service last week, try to do so now. Maybe you need a button trigger an update from the web page.

You could also same the exchange rate information to disk and load it when the program starts. In this way you would not need to stay online all the time to have a update exchange rate calculator at your hands.



site: Håvard Rast Blok
mail:
updated: 16 July 2010