root = (Region) fxmlLoader.load();
} catch (Exception ex) {
ex.printStackTrace();
}
// The Undecorator as a Scene
final UndecoratorScene undecoratorScene = new UndecoratorScene(primaryStage, root);
// Enable fade transition
undecoratorScene.setFadeInTransition();
// Optional: Enable this node to drag the stage
// By default the root argument of Undecorator is set as draggable
// Node node = root.lookup("#draggableNode");
// undecoratorScene.setAsStageDraggable(stage, node);
/*
* Fade transition on window closing request
*/
primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent we) {
we.consume(); // Do not hide
undecoratorScene.setFadeOutTransition();
}
});
// Application icons
Image image = new Image("/demoapp/in-sidefx.png");
primaryStage.getIcons().addAll(image);
primaryStage.setScene(undecoratorScene);
primaryStage.sizeToScene();
primaryStage.toFront();
// Set minimum size based on client area's minimum sizes
Undecorator undecorator = undecoratorScene.getUndecorator();
primaryStage.setMinWidth(undecorator.getMinWidth());
primaryStage.setMinHeight(undecorator.getMinHeight());
// Feed Charts with fake data for demo
initCharts();