Reputation: 36299
I am trying to apply css styles to A TreeView
TreeItem
but for some reason the item isn't picking up, and applying the style. Here is a snippet of the fxml
file. As you can see the TreeView
doesn't have any items, that is because I am adding them at a later time.
<AnchorPane styleClass="/media/css/TreeItem.css" id="AnchorPane" fx:id="main" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="db.manager.MainController">
<children>
<AnchorPane>
<children>
<TreeView editable="true" showRoot="false" />
</children>
</AnchorPane>
</children>
</AnchorPane>
I then have the following css in the file css file mentioned in the above fxml
:
.tree-cell{
-fx-indent: 100;
-fx-underline: true;
-fx-background-image: url("/media/images/database.png");
-fx-background-repeat: no-repeat;
}
I am not getting any errors, so I know that the file is loading, but the style aren't getting applied to the newly added TreeItem
's and I have no idea why.
Upvotes: 0
Views: 244
Reputation: 209319
You need
<AnchorPane stylesheets="/media/css/TreeItem.css" ... >
not
<AnchorPane styleClass="/media/css/TreeItem.css" ... >
Upvotes: 1