我對JavaFX上下文中的CSS並不十分了解。 我試圖訪問一些TitledPanes的標籤,所以我可以把一個簡單的圖像旁邊的標籤,但我無法弄清楚什麼是適當的語法是這樣做的。我需要使用什麼CSS語法來訪問JavaFX中TitledPane的標籤?
我已經試過:
.TitledPane > .title > .text { //TitledPane is the CSS class I assign to my Title Panes.
/*CSS Code Here*/
}
這沒有奏效。
.TitledPane > .title { } //This only affects the background, I would like the graphic to be side-by-side with the actual text.
.TitlePane LabeledText { } //This worked with Buttons so I thought it might work with TitledPane. I was wrong.
我需要使用什麼來訪問標籤才能使用CSS來設置它的樣式?
此無關的HTML。這是JavaFX。 JavaFX控件可以使用CSS樣式表來指定它們的樣式。 – Will 2014-10-09 17:06:02
你需要css嗎?爲什麼不在Java代碼(或FXML中的等價物)中執行'myTitledPane.setGraphic(...)'? – 2014-10-09 17:15:58
是的,我知道這是一個選項,但如果可以在CSS中做,我寧願保持Java代碼相對簡潔。這是最後的手段。 – Will 2014-10-09 17:29:21