javafx - Changing the title image of a TitledPane -
using listener intend change background image of titledpane though have not achieved it. when start code, stylesheet shows 'downarrow' when expand/collapse titledpane, image disappears , nothing displayed. images use in same folder code , style sheet. code using following:
titledpane.expandedproperty().addlistener((obs, wasexpanded, nowexpanded) -> { if (nowexpanded) { titledpane.lookup(".title").setstyle( "-fx-background-image : url('downarrow.png'); " ); } else { titledpane.lookup(".title").setstyle( "-fx-background-image : url('leftarrow.png'); " ); } }); css file:
.titled-pane > .title { -fx-background-image : url('downarrow.png'); -fx-background-repeat: stretch; -fx-background-position: right; }
Comments
Post a Comment