Netbeans GUI building on pre-defined code
Posted
by deliriumtremens
on Stack Overflow
See other posts from Stack Overflow
or by deliriumtremens
Published on 2010-04-10T15:34:56Z
Indexed on
2010/04/10
16:13 UTC
Read the original article
Hit count: 325
I am supposed edit some code for an assignment, and he gave us the framework and wants us to implement code for it. I load the project into netbeans and can't figure out how I'm supposed to edit the swing components. I don't see how to edit source vs. design.
import javax.swing.*;
import java.util.*;
import java.io.*;
public class CurrencyConverterGUI extends javax.swing.JFrame {
/**************************************************************************************************************
insert your code here - most of this will be generated by NetBeans, however, you must write code for the event listeners and handlers for the two ComboBoxes, the two TextBoxes, and the Button. Please note you must also
poulate the ComboBoxes withe currency symbols (which are contained in the KeyList attribute of
CurrencyConverter CC)
***************************************************************************************************************/
private CurrencyConverter CC;
private javax.swing.JTextField Currency1Field;
private javax.swing.JComboBox Currency1List;
private javax.swing.JTextField Currency2Field;
private javax.swing.JComboBox Currency2List;
private javax.swing.JButton jButton1;
private javax.swing.JPanel jPanel1;
}
class CurrencyConverter{
private HashMap HM; // contains the Currency symbols and conversion rates
private ArrayList KeyList; // contains the list of currency symbols
public CurrencyConverter() {
/**************************************************
Instantiate HM and KeyList and load data into them.
Do this by reading the data from the Rates.txt file
***************************************************/
}
public double convert(String FromCurrency, String ToCurrency, double amount){
/***************************************************************************
Will return the converted currency value. For example, to convert 100 USD
to GBP, FromCurrency is USD, ToCurrency is GBP and amount is 100. The rate
specified in the file represent the amount of each currency which is
equivalent to one Euro (EUR). Therefore, 1 Euro is equivalent to 1.35 USD
Use the rate specified for USD to convert to equivalent GBP:
amount / USD_rate * GBP_rate
****************************************************************************/
}
public ArrayList getKeys(){
// return KeyList
}
}
This is what we were given, but I can't do anything with it inside the GUI editor. (Can't even get to the GUI editor). I have been staring at this for about an hour. Any ideas?
© Stack Overflow or respective owner