What Not to Do
As the exception says, you
Cannot set style once stage has been set visible
So, if you can't do that, don't try to do it.
What to Do
Instead, hide your transparent stage and create a new stage with the new style.
When doing so, be careful because the default behaviour is to shut down the JavaFX system once all stages have been hidden. To avoid this either switch off the default behaviour and explicitly shutdown the JavaFX system when needed or ensure that you always have at least one Window visible.
Example
// initialize your splash stage.
Platform.setImplicitExit(false);
splashStage.initStyle(StageStyle.TRANSPARENT);
. . .
// create your main stage.
Stage mainStage = new Stage();
mainStage.setScene(mainScene);
mainStage.initStyle(StageStyle.DECORATED);
mainStage.setOnHide(event -> Platform.exit())
. . .
// on some later event hide your splash stage and show your main stage.
splashStage.hide();
mainStage.show();
Related
Here is a full executable sample based on an answer to a previous question => How to create Splash screen with transparent background in JavaFX.