简体   繁体   English

onToped JFrame打开JDialog =对话框,而不是在JFrame上

[英]onToped JFrame opens JDialog = dialog not ontoped over JFrame

Well, if we have onToped JFrame 好吧,如果我们有onToped JFrame

this.setAlwaysOnTop(true);

and then open JDialog 然后打开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 . 在这种情况下, JDialog将在' 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 如果我关闭对话框(置于关闭状态)并再次打开,它将开始正常工作并显示在JFrame

What's happening? 发生了什么?

ColorDialog应该将jFrame作为父级。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM