开发者

Java: If a custom JDialog is hidden, is focus returned back to its parent?

开发者 https://www.devze.com 2022-12-21 19:54 出处:网络
I am creating a custom J开发者_JAVA技巧Dialog. I need to hide the JDialog (without removing it from memory) so that its parent can call a method on the JDialog (getResults()).

I am creating a custom J开发者_JAVA技巧Dialog. I need to hide the JDialog (without removing it from memory) so that its parent can call a method on the JDialog (getResults()).

JDialog dialog = new JDialog(.....);

///Code WITHIN JDialog:
{
//JDialog opens and its actions are performed

this.setVisible(false); //Does this allow the parent to gain focus once more?

}


It depends: whether JDialog modaless is or not. And also if you extend JDialog then:

Yes.
If it will disable focusing other windows, it will release this constraint when the JDialog is hidden. If the JDialog is visible again, it will be impossible to focus the other windows again.

0

精彩评论

暂无评论...
验证码 换一张
取 消