RootPane
is essential to support dialogs, internal frames, validation, root layers and window
decoration. Therefore RootPane
always has to be the root Node
of your Scene
.
In most cases creating a RootPane
is required for the primary stage only. By using the Frame
or
Dialog
classes of SyntheticaFX, the related Scene
and the RootPane
instances will be
created under the hood.
Scene scene = new Scene(new RootPane(stage, createContentPane()));
stage.setScene(scene);
stage.setTitle("MyWindow");
...
A RootPane
can have a title pane for the window controls and a content pane for your UI-content i.e. forms.
Window decoration is styleable by CSS. In the screenshots below a customized smaller title pane with right aligned title
text and modified close icon is used for the palette window.
window.
The tile pane layout is based on FXML and can be easily customized with the SceneBuilder tool. The resulting FXML file will be bound to a style class through the related CSS property. A special pseudo class can be used to support different layouts for different operation systems.
For creating a RootPane
with native window decoration the related constructor has to be used. In the example below
native window decoration is enabled for the primary stage. The static methods Frame#setNativeDecorationEnabled(true)
and Dialog#setNativeDecorationEnabled(true)
enable native window decroation for all Frame
and Dialog
instances.
new SyntheticaFXStandard().init();
Frame.setNativeDecorationEnabled(true);
Dialog.setNativeDecorationEnabled(true);
Scene scene = new Scene(new RootPane(primaryStage, createContentPane(), true, true), 600, 400);
stage.setScene(scene);
stage.setTitle("MyWindow");
...