onToped JFrame 打开 JDialog = 对话框未覆盖在 JFrame 上
好吧,如果我们有 onToped JFrame
this.setAlwaysOnTop(true);
,然后打开 JDialog
,
private void colorChooseMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
ColorDialog fc = new ColorDialog();
fc.setLocationRelativeTo(this);
fc.setModal(true);
fc.setVisible(true);
}
在这种情况下,JDialog
将位于 JFrame
的“下方”。当我单击框架时,对话框移至顶部。如果我关闭对话框(关闭时处理)并再次打开,它会开始正常工作并显示在 JFrame
上,
发生了什么?
Well, if we have onToped JFrame
this.setAlwaysOnTop(true);
and then open JDialog
private void colorChooseMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
ColorDialog fc = new ColorDialog();
fc.setLocationRelativeTo(this);
fc.setModal(true);
fc.setVisible(true);
}
in this case JDialog
will be 'under' JFrame
. When I click to frame, dialog moved to top. If I close dialog (dispose on close) and open again it start working normally and showed over JFrame
What's happening?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ColorDialog 应该以 jFrame 作为父级。
The ColorDialog should have the jFrame as parent.