0
我的Java JComboBox
actionPerformed是在由陣列循環從一個數組
假設組合框將列出:
"Argentina Vs USA" // array[0]
"Brazil Vs Canada" // array[1]
"Canada Vs Netherland" // array[2]
"Holland Vs Netherland" // array[3]
然後,一旦一個選項被選擇在..
actionPerformed(ActionEvent e){
JComboBox cb = (JComboBox)e.getSource();
String countryVScountry = (String)cb.getSelectedItem();
//I need help here, I don't want to get the String, but the
//array number instead.
//e.g. I choose "Brazil Vs Canada"
//What method should I use to make it return "1"?
//then if I choose "Holland Vs Netherland", it will return 3
}
我不想獲取字符串,而是數組數字。 例如我選擇「巴西VS加拿大」
- 我應該用什麼方法使它返回「1」?
- 然後如果我選擇 「荷蘭Vs的荷蘭」,它將返回3
荷蘭VS荷蘭? – wchargin 2013-05-10 21:40:37
gratz指出這一點!哈哈 – 2013-05-10 21:42:14