Igor Bloom
Igor Bloom

Reputation: 320

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. 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

Upvotes: 1

Views: 613

Answers (1)

Igor Bloom
Igor Bloom

Reputation: 320

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.

P.s. 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

If there is better solution, please welcome

Upvotes: 0

Related Questions