我创建了自己的标记以检查选项框中的项目但是当我通过选择的选项时,会再次出现默认形状,我该如何删除它?
.choice-box{
-fx-mark-color: transparent; /* OK */
}
.choice-box > .context-menu > .menu-item:checked > .left-container{
-fx-background-image: url('myMark.png'); /* OK */
-fx-background-repeat: no-repeat; /* OK */
}
.choice-box > .context-menu > .menu-item:checked:hover > .left-container{
-fx-background-color: red; /* OK */
}
.choice-box > .context-menu > .menu-item:checked:hover > .left-container > .mark{
-fx-background-color: transparent; /* Not work */
-fx-shape: none; /* Not work */
}
.choice-box > .context-menu > .menu-item:checked:hover > .left-container > .check{
-fx-background-color: transparent; /* Not work */
-fx-shape: none; /* Not work */
}
答案 0 :(得分:0)
访问标签标记的简便方法是使用-fx-focused-mark-color
,因此完整代码为:
.choice-box{
-fx-mark-color: transparent; /* OK */
-fx-focused-mark-color: transparent; /* The solution! */
}
.choice-box > .context-menu > .menu-item:checked > .left-container{
-fx-background-image: url('myMark.png'); /* OK */
-fx-background-repeat: no-repeat; /* OK */
}
.choice-box > .context-menu > .menu-item:checked:hover > .left-container{
-fx-background-color: red; /* OK */
}