2017-05-01 24 views
0

我希望我的選擇框在用戶選擇某種東西前後看起來相同,並且沒有任何焦點指示符。網絡搜索表明我應該調整-fx-focus-color:和-fx-faint-focus-color:但我似乎無法使其保持一致。我使用透明(下面),因爲除了透明之外的任何顏色都會在選擇後在選擇框周圍產生寬廣的光暈。前javafx 8如何使choicebox在選擇前後看起來相同(無焦點)

default look, no css settings 

選擇:enter image description here
之後選擇:enter image description here

-fx-focus-color: transparent; 
-fx-faint-focus-color: transparent; 

之前選擇:enter image description here
之後選擇:enter image description here

-fx-faint-focus-color: transparent; 

之前選擇:enter image description here
後選擇:enter image description here

-fx-focus-color: transparent; 

之前選擇:enter image description here
之後選擇:enter image description here

回答

1

試試這個。

.choice-box:focused { 
    -fx-background-color: -fx-shadow-highlight-color, -fx-outer-border, -fx-inner-border, -fx-body-color; 
    -fx-background-insets: 0 0 -1 0, 0, 1, 2; 
    -fx-background-radius: 3px, 3px, 2px, 1px; 
} 

你可以在這裏看到默認的CSS(= modena.css):OpenJDK/openjfx/8/master。 上面的代碼只是.choice-box和.choice-box之間的區別:重點。

相關問題