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.
精彩评论