2013-01-02 94 views
6

如何更改JavaFX中的突出顯示顏色?通常它是漸變的藍色,但我想要綠色突出顯示。我曾嘗試以下內容:如何更改JavaFX中的高亮顏色?

.root{ 
    -fx-shadow-highlight-color: #CCFF99; 
} 

感謝您的幫助!

回答

18

caspian.css(JavaFX的2)或modena.css(JavaFX的8)

.root { 
    /* A bright blue for highlighting/accenting objects. For example: selected 
    * text; selected items in menus, lists, trees, and tables; progress bars; 
    * default buttons. 
    */ 
    -fx-accent: #0093ff; 

    /* A bright blue for the focus indicator of objects. Typically used as the 
    * first color in -fx-background-color for the "focused" pseudo-class. Also 
    * typically used with insets of -1.4 to provide a glowing effect. 
    * 
    * TODO: should this be derived from -fx-accent? 
    */ 
    -fx-focus-color: #0093ff; 
} 

更改根據其用途這些顏色。

+0

非常感謝!我應該手動更改ListViews的懸停背景嗎?或者有沒有辦法改變他們的全球像-fx口音? – stetro

+2

ListView懸停顏色是:'-fx-cell-hover-color' - 它也可以在[caspian.css中找到 - 這裏是2.2版本的鏈接](http://hg.openjdk.java.net/的OpenJFX/2.2 /主/ RT /原始文件/塞尖/ JavaFX的UI的控制/ SRC/COM /太陽/ JavaFX的/場景/控制/皮膚/裏海/ caspian.css) – jewelsea

相關問題