fxmlLoader.setController(this);
root = (Region) fxmlLoader.load();
} catch (Exception ex) {
ex.printStackTrace();
}
Stage utilityStage = new Stage();
utilityStage.setTitle("Stage Utility type demo");
UndecoratorScene scene = new UndecoratorScene(utilityStage, StageStyle.UTILITY, root, null);
utilityStage.setScene(scene);
utilityStage.initModality(Modality.WINDOW_MODAL);
utilityStage.initOwner(primaryStage);
// Set sizes based on client area's sizes
Undecorator undecorator = scene.getUndecorator();
utilityStage.setMinWidth(undecorator.getMinWidth());
utilityStage.setMinHeight(undecorator.getMinHeight());
utilityStage.setWidth(undecorator.getPrefWidth());
utilityStage.setHeight(undecorator.getPrefHeight());
if (undecorator.getMaxWidth() > 0) {
utilityStage.setMaxWidth(undecorator.getMaxWidth());
}
if (undecorator.getMaxHeight() > 0) {
utilityStage.setMaxHeight(undecorator.getMaxHeight());
}
utilityStage.sizeToScene();
utilityStage.show();
}