我正在尝试创建一个输入框,用于接收用户的响应。我注意到eclipse在icon参数(文本,答案)之后给了我2个额外的参数,而且我不确定它们应该包含在内。
String answer = JOptionPane.showInputDialog(null, "Give us a word starting with "+text[i]+":", "ABCTutor", 0, image, text, answer);
答案 0 :(得分:1)
selectionValues - an array of Objects that gives the possible selections
initialSelectionValue - the value used to initialize the input field
一个例子:
Object[] options = { "OK", "CANCEL" };
JOptionPane.showOptionDialog(
null,
"Click OK to continue",
"Warning",
JOptionPane.DEFAULT_OPTION,
JOptionPane.WARNING_MESSAGE,
null,
options, // available options
options[0]); // default option