public class Demo extends Application {
@Override
public void start(Stage primaryStage){
new SyntheticaFXStandard(){
@Override
protected void loadCssExtension() {
//addCss("/com/company/css/custom.css");
addCss("/test/frame/palette.css");
};
}.init();
Scene scene = new Scene(new RootPane(primaryStage, createContent()), 800, 600);
primaryStage.setScene(scene);
primaryStage.setTitle("SyntheticaFX Demo");
primaryStage.show();
}
...
In the example above an additional style for a Palette
window is loaded and can be easily applied to a
window by adding the related style class. The Palette
style was added to the right window below. As you can see the
title panel and the font is smaller, all buttons except the close button have been removed and the shadow effect of the frame
is smaller.
Frame f = new Frame(primaryStage, "Palette Frame Test", createContent());
f.getRootPane().getStyleClass().add("palette");
f.show();
...
In the example we used a custom FXML-file for the title pane to remove not needed buttons - palette.css:
.palette{
-sfx-fxml-title-pane: url("/test/frame/palette.fxml");
-sfx-title-alignment: right;
-fx-border-image-insets: 8; /*shadow-size;*/
-fx-effect: dropshadow(three-pass-box, #888, 6, 0.005, 0, 0);
}
.palette:focused, .palette:selected{
-fx-effect: dropshadow(three-pass-box, #444, 10, 0.01, 0, 0);
}
.palette .root-pane-title-pane{
-fx-padding: 0 4 0 4;
}
.palette .root-pane-title-pane > .title-label{
-fx-font-size: 0.9em;
-fx-text-fill: #FEC;
-fx-effect: null;
}
.palette .root-pane-title-pane > .close-button{
-fx-background-color: red;
}