1

我正在创建一个自定义 JDialog。我需要隐藏 JDialog(不将其从内存中删除),以便其父级可以调用 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?

}
4

1 回答 1

1

这取决于:JDialog 是否是无模式的。如果你扩展 JDialog 然后:

是的。
如果它将禁用聚焦其他窗口,它将在隐藏 JDialog 时释放此约束。如果 JDialog 再次可见,则无法再次聚焦其他窗口。

于 2010-03-05T00:07:37.370 回答