//site address
    String response2=JOptionPane.showInputDialog(
        null,"Enter the site address:");
    address=new JTextField(response2,20);    //site type
    String choices[]={"Personal","Commercial","Unknow"};
    int response3=JOptionPane.showOptionDialog(
        null,"What type of site is it?","Site Type",0,
        JOptionPane.QUESTION_MESSAGE,null,choices,choices[0]);
    type=new JTextField(choices[response3],20); //??????????????请问在site type里的type=new JTextField(choices[response3],20)是什么意思
为什么他没有像site address里的address=new JTextField(response2,20)那样
choices[response3]是啥意思?choices[]不是初始化过了吗,怎么有用这个??

解决方案 »

  1.   

    type=new JTextField(choices[response3],20)是得到一個長度為20,以choices[response3]的字符串為內容的文本框,其中response3={0,1,2},所以
    choices[response3]= "Personal","Commercial","Unknow"之一;你這段程序是在一個輸入框輸入網站地址,然後在一個對話框顯示站點的類型.Java的問題你可以到java論壇提更好.