我现在想在一个JDialog为基类的界面中使用模态的文件打开/保存对话框,查过FileDialog构造器的参数,要求一个Frame的参数,可是我JDialog并不继承至Frame啊,所以请问各位怎么才能实现我想要的功能呢?

解决方案 »

  1.   

    有这函数吗?是setMode吧而且setMode是用来设置是load or save的, 也不是设置模态不模态的
      

  2.   

    public void setModal(boolean b)Specifies whether this dialog should be modal.
      

  3.   

    这个函数我试过了,可是即使把参数设置成了true,一样还是非模态的,因为他没有办法指定父窗口啊?
      

  4.   

    JDialog的构造函数不有:
    JDialog(Frame owner, boolean modal) 
              Creates a modal or non-modal dialog without a title and with the specified owner Frame.没有父类的话,传Null值。