2016-12-28 242 views
0

我試圖使用方法here隱藏ComboBox箭頭,但由於某種原因,我得到這個: enter image description hereJavaFX的:隱藏COMBOX箭頭

+0

這看起來像一個TextField,你做了哪些修改? –

+0

我添加了鏈接中描述的css –

+0

該解決方案適用於我,嘗試發佈自己的代碼,錯誤可能來自那裏! –

回答

0

試試這個:

.combo-box, .arrow, .arrow-button{ 
    -fx-background-color: transparent; 
} 

擺脫所有其他顏色顯示(聚焦:邊框顏色/邊框輝光而散:影子)添加的.text場

.combo-box, .arrow, .arrow-button, .text-field{ 
    -fx-background-color: transparent; 
} 

注意每個文本字段/箭頭/箭頭按鈕都會受到影響。爲了解決這個問題,你需要你的CSS樣式表添加到節點本身

your-combo-box-node.getStylesheets().add(Main.class.getResource("styles.css").toExternalForm()); 

如果需要使用節點本身的各個部分的造型更多的靈活性,分裂的CSS-代碼 - line

.combo-box{ -fx- ... } 
.arrow{ -fx- ... } 
.arrow-button{ -fx- ... } 
.text-field{ -fx- ... }