5

I want to show a FileChooser dialog on top of an awt app which uses a JFXPanel.

As Window for showOpenDialog, I use getWindow() of the Scene set to that panel. But the file chooser appears behind the app and everything in the JFXPanel still remains active (i.e. I can open more FileChooser dialogs, enter text, etc.).

I also found some example code with an additional Stage between the JFXPanel's Scene Window and FileChooser, which uses initModality. But there's no change in behaviour.

Any ideas how to open FileChooser as a modal dialog when the parent's a JFXPanel?

M. Schenk
  • 314
  • 3
  • 8
  • After all these years, this is still a problem, here's an open bug for anyone who finds this.. https://bugs.openjdk.java.net/browse/JDK-8087620 – meyertee Aug 12 '15 at 19:11

1 Answers1

0

showOpenDialog() is a blocking operation. It should stop capturing events by the JavaFX Application Thread. Since you are using swing, there's also Event Dispatch Thread. I would disable the whole window before showOpenDialog() and then re-enable after. Make sure, that you are accessing JFXPanel from the J.A.T.

drzymala
  • 2,009
  • 20
  • 26