-1
我有一個下拉框,從Oracle網站的這個例子:下拉對話框
Object[] possibilities = {"ham", "spam", "yam"};
String s = (String)JOptionPane.showInputDialog(
frame,
"Complete the sentence:\n"
+ "\"Green eggs and...\"",
"Customized Dialog",
JOptionPane.PLAIN_MESSAGE,
icon,
possibilities,
"ham");
//If a string was returned, say so.
if ((s != null) && (s.length() > 0)) {
setLabel("Green eggs and... " + s + "!");
return;
}
//If you're here, the return value was null/empty.
setLabel("Come on, finish the sentence!");
我只是想知道你是如何改變了每個選擇會做什麼?例如,我是否需要在聲明if ((s != null) && (s.length() > 0)) {
中更改某些內容,以便我可以編輯第一個字符串項目?
你所說的「是什麼每個選擇都會做」的意思是? – 2013-03-20 11:48:19