I\'m trying to make my Pane a little bit better, visually, so, what I\'m doing is: set my stage UNDECORATED (OK) and (TRYING) to add a drop-shadow effect (NOT OK).
I\
Simple working example.
Here is fxml
structure:
AnchorPane(200,200) // pane for space for shadow
\- AnchorPane(center) // appliction pane
\- Label // application content
Real screen.fxml
:
Main.java
@Override
public void start(Stage stage) throws Exception {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/sample/screen.fxml"));
AnchorPane shadowPane = loader.load();
AnchorPane rootPane = (AnchorPane) shadowPane.lookup("#rootPane");
rootPane.setStyle("-fx-effect: dropshadow(gaussian, rgba(0, 0, 0, 0.4), 10, 0.5, 0.0, 0.0);" +
"-fx-background-color: white;"); // Shadow effect
Scene scene = new Scene(shadowPane);
stage.setScene(scene);
shadowPane.setBorder(new Border(new BorderStroke(Color.RED, BorderStrokeStyle.SOLID, null, null))); // Some borders for for clarity
shadowPane.setStyle("-fx-background-color: transparent;"); // Makes shadowPane transparent
scene.setFill(Color.TRANSPARENT); // Fill our scene with nothing
stage.initStyle(StageStyle.TRANSPARENT); // Important one!
stage.show();
}