I've been tinkering with similar settings, and this works for me:
@Override
public void start(Stage primaryStage) throws Exception{
Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
primaryStage.setTitle("Hello World");
primaryStage.initStyle(StageStyle.TRANSPARENT);
primaryStage.setOpacity(0.5);
primaryStage.setFullScreen(true);
Scene scene = new Scene(root, 300, 275);
primaryStage.setScene(scene);
scene.getStylesheets().add(Main.class.getResource("main.css")
.toExternalForm());
primaryStage.show();
}
...and the css
.root {
-fx-background-color: rgba(0,0,0,0.5);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…