Make a javafx stage the owner of a JDialog?


Display a swings JDialog containing a JRViewer for Jasper Report, from within a javafx application menu item click. BUT the JDialog is not MODAL even after setModal(true) as it is not owned by javafx stage. How to make a javafx stage the owner of a JDialog? Alternatively how to display a Jasper report inside a javafx stage, scene?

1/5/2013 8:19:35 PM

Back to the first (base) question: It's not possible to make a Stage the owner of a JDialog. But, after setting the content of the SwingNode


you can get the parent of xxx (may be the parent of the parent of xxx too...) until you find a (AWT-) Frame or (AWT-) Dialog. In the case of SwingNode it's a JLightweightFrame. This object you can use as the owner to create your JDialog.

But, I think there is a bug in the JavaFX SwingNode mechanism. The JDialog appears functionally modal, if you set it modal (setModal(true)), but it may appear behind the main (JavaFX) window. It's still possible to move the main window, to bring it in front and so on, what should not be possible if there is a modal dialog. But this is another topic.

1/9/2016 1:14:50 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow