简体   繁体   English

当附加(非模态)窗口关闭时,如何防止将主应​​用程序窗口置于最前面。 Mac OS,JavaFX

[英]How can I prevent to bring main application window to front when an additional (non modal) window closing. Mac OS, JavaFX

On Mac OS there is one problem with javaFX application windows. 在Mac OS上,javaFX应用程序窗口存在一个问题。 When I have two window and want to close one of them, the second window (main window) will bring itself to front. 当我有两个窗口并要关闭其中一个窗口时,第二个窗口(主窗口)将显示在前面。 Looks like closed window returns focus to main window. 看起来像关闭的窗口将焦点返回到主窗口。 How can I prevent this action? 如何防止此动作?

The second window opens only if there is need to show some notifications. 仅当需要显示一些通知时,第二个窗口才会打开。

stage = new Stage();
stage.setResizable(false);
stage.initStyle(StageStyle.TRANSPARENT);
stage.initModality(Modality.NONE);
stage.setAlwaysOnTop(true);
stage.setWidth(width);
stage.setHeight(height);
stage.setScene(scene);
stage.show();

OS X v10.9.5 java 1.8.60 OS X v10.9.5 Java 1.8.60

There is only one solution for me: insetad of closing window, move it out of screen bounds, and when I need to show this window again - simply change it coordinates. 对我来说,只有一个解决方案:关闭窗口的insetad,将其移出屏幕边界,当我需要再次显示此窗口时,只需更改其坐标即可。

Ps On unix systems KDE do not allow to move window out of bounds, on thoses systems the window need to be moved to 0,0 position and scaled to width=1, height=1 Ps在unix系统上,KDE不允许将窗口移出边界,在那些系统上,需要将窗口移至0,0位置并缩放为width = 1,height = 1

If there is better solution, please welcome 如果有更好的解决方案,欢迎您

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

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