【发布时间】:2016-12-07 13:18:58
【问题描述】:
尝试为我的BorderPane 创建阴影。我需要使用StackPane 为阴影留出空间。问题是我似乎无法将StackPane 的背景设置为透明。我正在为我的primiaryStage 使用透明样式。
还有其他使用 javaFX 的示例,但我在使用 fxml 时无法弄清楚。
.StackPane{
-fx-background-color: transparent;
}
这仍然在我的 BorderPane 后面显示白色背景
public class Main extends Application {
public static Stage Window;
@Override
public void start(Stage primaryStage) throws IOException{
Main.Window = primaryStage;
Window.initStyle(StageStyle.TRANSPARENT);
Window.setResizable(false);
FXMLLoader loader = new FXMLLoader(getClass().getResource("Homepage.fxml"));
Parent root = loader.load();
Window.setScene(new Scene(root));
root.getStylesheets().add(getClass().getResource("main.css").toExternalForm());
Window.show();
}
【问题讨论】:
标签: java css javafx scenebuilder