views:

211

answers:

1

I am creating a custom JDialog. 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?

}
A: 

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.

Pindatjuh
Does it need to be modal or modaless in order for this to work?
WaelJ
The JavaDoc says: `@param modal specifies whether dialog blocks user input to other top-level windows when shown`So it needs to be modal (true).
Pindatjuh
OK thanks alot :)
WaelJ