我很难将部分数组输出到JOptionPane.showOptionDialog()
。我有一个用户提示要求1-10之间的整数,并希望从数组输出该数量的项目。
options = JOptionPane.showInputDialog("How many options would you like?"+
"\n\nPlease note that you must input a number between 1-10");
try{
numberofoptions = Integer.parseInt(options);
}
catch(NumberFormatException e){
JOptionPane.showMessageDialog(null, "Remember to only input a numerical integer");
}
JOptionPane.showOptionDialog(null, "Please select a restaurant.", "Restaurant Selector",
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, Restaurants, Restaurants[0]);
exit = JOptionPane.showConfirmDialog(null, "Do you wish to continue?", "Restaurant Selector",
JOptionPane.YES_NO_OPTION);
答案 0 :(得分:0)
您可以使用datatype
方法获取第一个Arrays.copyOf
餐馆:
n