How to create splash screen in tornadofx

668 Views Asked by At

I could not find any example, neither any resource on how to create a splash screen in tornadofx. I have a working splash screen in plain javafx along the same line of this example : https://gist.github.com/jewelsea/2305098

But, I have no clue on how to achieve it in tornadofx as it uses different paradigm with views and fragments instead of stage and screen.

1

There are 1 best solutions below

0
On BEST ANSWER

You are not using the JavaFX preloader here as far as I can see, so this is really no different from opening one View while you do your loading, and then replacing that View with another View when you're done. Just point your app class to a SplashScreenView, handle your loading there, then do replaceWith(MainView::class) when you are done. In MainView, you might want to override the onDock callback and do currentStage?.sizeToScene() to make sure the window resizes to your desired size.