0

I have a java command line app that at some point launches a JavaFX app. I need to pause it or hide it, do some work, and then show the app again. I'm launching the app like so:

Application.launch(GatherInputGui.class);

... and since I can do that only once, I wonder what my options are to show it again.

Could I set/update a system property and have the JavaFX app observe it and react to the prop change?

vector
  • 7,334
  • 8
  • 52
  • 80
  • 4
    A **system** property wouldn't be a good way to go about this. It would also be simpler to launch the console logic from the `Application`'s `start` (or `init`) method, since that way you can avoid passing data via `static` variables: if the GUI needs to be shown/hidden from a single thread only, you could simply create a `BooleanProperty` that you toggle when the GUI needs to be shown/hidden and add a listener that uses `Platform.runLater` to update the GUI. Be sure to set `Platform.implicitExit` to `false` and use `Platform.exit` once you no longer need the GUI. – fabian Feb 17 '20 at 17:30
  • See https://stackoverflow.com/questions/24320014/how-to-call-launch-more-than-once-in-java/24320562#24320562 – James_D Feb 18 '20 at 13:16

0 Answers0