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
.
- In the
windowOpened
event you hide the frame - in the
windowClosed
event you show the frame.