错误为:local variable s,a1 is accessed from within inner class;needs to be declared final

解决方案 »

  1.   

    这句话好像不对,你看看parent是什么类型
    Frame)this.getParent(),
      

  2.   

    http://community.csdn.net/Expert/topic/3223/3223542.xml?temp=.4862177
      

  3.   

    Dialog a = new Dialog(this);匿名内部类访问的外部数据必须要设置为final
      

  4.   

    String s;          // 得到用户输入
    改成
    final String s;
      

  5.   

    http://community.csdn.net/Expert/TopicView1.asp?id=3222720
      

  6.   

    谢谢各位关注。请问javatomchen,如何看parent类型?
      

  7.   

    现在可以显示该对话框,只是看不见Label,TextField,整个窗口只看到Button按键。为什么?还有怎样实现按了Button,就关闭该对话框呢?
      

  8.   

    一如直接来个,JOptionPane.showMessageDialog(this.getParent(), "show the string");
      

  9.   

    frame f=new Frame();
    Dialog d=new Dialog(f,"ss",true);
      

  10.   

    用楼上的方法,直接new 一个frame时,关闭applet,frame还存在。
      

  11.   

    我新建了一个MyDialog类,然后在applet中调用该类,发现applet运行出错。报nullPointerException