How to hide a JFrame when a JDialog class is open

强颜欢笑 提交于 2019-12-25 04:19:29

问题


I am tring to Hide a JFrame when a JDialog box opened, please how doi do this usuing the addActionListener();


回答1:


When you create a JDialog you should be specifying the JFrame as the owner of the dialog, then you can use the getOwner() method of the dialog to get the frame reference at any time.

In you JDialog you should be able to use a WindowListener.

  1. In the windowOpened event you hide the frame
  2. in the windowClosed event you show the frame.


来源:https://stackoverflow.com/questions/22334749/how-to-hide-a-jframe-when-a-jdialog-class-is-open

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!