I\'m trying to create a stage that doesn\'t appear on the Windows task bar and is undecorated (no borders and no close/minimize/maximize buttons). My end goal is to create a
This question is not really fresh, but I had the same problem and found no solution at first, but here is my workaround :)
The best solution I found was to set the primaryStage to style Utility and to make all childStages to Style Undecorated. Then set the opacity of the primaryStage to 0.0 so its not visible: PrimaryStage:
primaryStage.initStyle(StageStyle.UTILITY);
primaryStage.setOpacity(0);
primaryStage.show();
Childs:
this.initOwner(owner);
this.initStyle(StageStyle.UNDECORATED);
Example code
public void start(Stage primaryStage) throws IOException{
//make primaryStage utility
primaryStage.initStyle(StageStyle.UTILITY);
primaryStage.setOpacity(0);
Stage secondaryStage = new Stage();
secondaryStage.initOwner(primaryStage);
//make secondaryStage transparent
secondaryStage.initStyle(StageStyle.TRANSPARENT);
//load ui via FXMLLoader
FXMLLoader loader = new FXMLLoader(getClass().getResource("/ui.fxml"));
AnchorPane pane = loader.load();//example with anchor pane
Scene scene = new Scene(pane,400,400); //example width and height
scene.setFill(Color.TRANSPARENT); //make scene transparent as well
secondaryStage.setScene(scene);
primaryStage.show();
secondaryStage.show();
}