I'm developing an app which for some time will probably just use the command line. It may one day be appropriate to give it the whole JavaFX visual treatment: windows, dialogs, etc.
What I do currently need to do is allow the users to select files/directories from anywhere in the file system. The way I've done this is to make my main class, ConsoleHandler
, subclass from JavaFX Application
, and to run start()
at the start of the run, so in fact the app is running on the JavaFX thread. This means, among other things, that the thread allows the JavaFX FileChooser
to be displayed, and also waits while the user selects the file(s)/directories...
But this seems so WRONG! This is not (not yet anyway) a "visual" application. I would rather handle the "waiting for user input" by something simple, like an ExecutorService
, and use normal Thread
s.
I appreciate that a file chooser is indeed a "visual" feature in its own right, and obviously an "event" such as the clicking of a "Select" button, is involved: but having to use the whole JavaFX infrastructure for this purpose seems silly. I'm wondering whether something somehow more typing-based might exist.
NB I have no desire to use Swing's JFileChooser
: similar thoughts apply, and Swing is the past.
The thing I'm currently planning to do is to work around by hiving off all the FileChooser
functionality into an isolated module... but I just thought I'd ask if anyone knows of a way to avoid JavaFX completely for this use case.