私は親レイアウトのBorderPaneの左の位置にあるVBoxを使用しています。私は変更し、私のVBoxを含むBorderPaneの左側に画像の背景を使用するCSSファイルを使用したいと思います。私は私のccsファイルには次のようなことがありますが、それを動作させることはできません。borderpaneの背景が異なるjavafx
.vbox{
-fx-background-image: url("/ui/image11.jpg");
-fx-background-repeat: no-repeat;
-fx-background-position: center center;
-fx-background-size: 500 500;
}
.root{
-fx-background-color: #ecf0f1;
-fx-background-position: center center;
-fx-background-size: 500 500;
}
.button{
-fx-text-fill: #ecf0f1;
-fx-background-color: #455d7a;
-fx-position: center;
-fx-min-width: 150px;
-fx-transition-duration: 1;
}
このCSSファイルでは、.rootと.buttonのルールは適用されますが、.vboxでは適用されません。 BorderPaneのさまざまなセクションの背景をどのように管理できますか?
は、私は次のコード行でCSSファイルをインポートします。scene.getStylesheets().add(this.getClass().getResource("/styles/contentStyle.css").toExternalForm());
これが正しい方法ですか? CSSファイルは別のパッケージに入っています。