Java:如果隐藏自定义 JDialog,焦点是否会返回到其父级?

发布于 2024-08-23 11:41:50 字数 307 浏览 2 评论 0原文

我正在创建一个自定义 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?

}

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?

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

债姬 2024-08-30 11:41:50

这取决于: JDialog 是否是无模式的。而且如果您扩展 JDialog 那么:

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

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文