【问题标题】:JDialog: Accessing Jframe while Jdialog is activeJDialog:在 Jdialog 处于活动状态时访问 Jframe
【发布时间】:2015-04-06 19:09:37
【问题描述】:

我有一个扩展 JDialog 的类。当 JDialog 显示时,我单击其启动 Jframe 的显示按钮,但在关闭 JDialog 之前我无法访问 JFrame。如何在屏幕上存在 JDialog 的情况下访问 Jframe?

【问题讨论】:

    标签: java jdialog


    【解决方案1】:

    但在我关闭 JDialog 之前我无法访问 JFrame。

    这意味着您使用的是模态 JDialog。

    您需要使用非模态 JDialog。

    JDialog dialog = new JDialog(frame, false);
    ...
    dialog.setVisible(true );
    

    或者您可以在使对话框可见之前使用setModal(false) 方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-30
      • 1970-01-01
      • 1970-01-01
      • 2013-05-21
      相关资源
      最近更新 更多