2016-12-28 75 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- ... }