Netbeans的GUI構建我應該Edit,用於分配一些代碼,他給我們的框架,並要我們執行的代碼吧。我加載項目到NetBeans和想不通,我應該如何編輯Swing組件。我看不到如何編輯源代碼和設計。預先定義的代碼
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
}
}
這就是我們給出的,但在GUI編輯器中我無法做任何事情。 (甚至不能進入GUI編輯器)。我一直盯着這裏約一個小時。有任何想法嗎?