Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to refer to an anchor pane in css?

Tags:

css

javafx

pane

is there a possibility to refer to an anchor pane in css?

If the anchor pane happens to be the root, than it's ok:

.root{
-fx-background-image: url("xxx.yy");
}

It works. But if not, then how to do this? I tried .anchor-pane{}, it didn't work. Then I read, that anchor pane has everything that Pane has. So I tried .pane{} too... It didn't work.

How can I set the background to a none root anchor pane? Thank you!

like image 571
user3435407 Avatar asked Feb 26 '15 19:02

user3435407


1 Answers

You can always assign a css class and add it to the AnchorPane explicitly

anchorPane.getStyleClass().add("pane");

In your css :

.pane{
    -fx-background-image: url("xxx.yy");
}

You can perform the same by adding a css id

anchorPane.setId("pane");

In you css :

#pane{
    -fx-background-image: url("xxx.yy");
}
like image 54
ItachiUchiha Avatar answered Sep 30 '22 17:09

ItachiUchiha