Question

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?

}
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top