Javafx accordion with transparent background?

一世执手 提交于 2019-12-08 07:02:50

问题


Somehow accordion seems to behave differently than the other javafx elements, cause I cannot make its background transparent with CSS.

I found a hint somewhere with this:

.accordion.titled-pane > *.content {
   -fx-background-color: null;
}

But it didn't work. Maybe the syntax, I don't know, I tried without the > and * too...

My try was doing the same as with panels, so:

#leftTop{
    -fx-background-color: rgba(237, 243, 245, 0.8);
}

I set the fx:id. It doesn't work either. I made this with all the child nodes the same too, that are "above" the accordion itself, so with the titled pane and the anchor pane that is on the titled pane. The colouring part has its effect but not the transparency.

I have read that javafx had issues, but that comment was from 2013...

Do you know a solution? Thank you!


回答1:


You just need a space between .accordion and .titled-pane (the TitledPane is a child node of Accordion; without the space you are trying to match a single node that has both the style class accordion and the style class titled-pane):

.accordion .titled-pane > *.content{
    -fx-background-color: transparent ;
}

Note that if you want the title portion of the titled pane transparent, you can do that with

.accordion .titled-pane .title {
    -fx-background-color: transparent ;
}


来源:https://stackoverflow.com/questions/29038701/javafx-accordion-with-transparent-background

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!