日期:2014-05-20  浏览次数:20723 次

JOptionPane.showConfirmDialog问题
JOptionPane.showConfirmDialog(this,"是否开始新的比赛?");
弹出的对话框的选项是“是”和“否”,如何改成“yes”和“no”?
或者如何让我定义其他国家的语言?

------解决方案--------------------
Java code
 Object[] possibilities = {"XXOO", "XXOO", "XXOO" };//这里随便写,yes,no了

              int n=JOptionPane.showOptionDialog(null, "请选择你喜欢的","XXOO",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE,icon,possibilities,possibilities[0]);

              String s=”XXOO”;

              switch(n){

                     case 0:

                            s=s+”XXOO”;

                            break;

                     sase 1:

                            s=s+"XXOO";

                            break;

                     sase 2:

                            s=s+”XXOO”;

                            break;

                     default:

s=”XXOO”;

              }

              JOptionPane.showMessageDialog(null,s,"XXOO",

JOptionPane.INFORMATION_MESSAGE);

              System.exit(0);

              

       }