How to stop JavaFX clients in SBT (“fork” setting)

As a brief note, you need this “fork in run” setting in your sbt build.sbt file if you want JavaFX client/GUI applications to properly stop:

// see:
// fork in run := true

Compile / run / fork := true

Conversely, if you don’t use that setting and then you stop your JavaFX app that you started inside sbt, the app won’t stop properly and it will leave a Java process running, and at that point about all you can do is kill sbt and restart it, which gets annoying after a very short while. That setting causes sbt to create and run the JavaFX app in a new JVM. As noted in the code, I found that setting on SO.