简体   繁体   English

JavaFX8 ChoiceBox透明吗?

[英]JavaFX8 ChoiceBox transparent?

I want to make a ChoiceBox transparent, so that it looks like a label. 我想使ChoiceBox透明,使其看起来像一个标签。 Is it possible to hide the arrow on the right and the background? 是否可以隐藏右侧和背景上的箭头? The Popup should be like default. 弹出窗口应类似于默认设置。 Which CSS-Classes do I have to use here? 我必须在这里使用哪些CSS类?

Best regards 最好的祝福


Website for this kind of information on css in jfx: CSS Reference Guide jfx中有关CSS的此类信息的网站: CSS参考指南

Here is how you can manipulate the nodes inside of a coice box: 这是您可以操作coice框内节点的方法:

.choice-box > .open-button > .arrow{
    /* Example: -fx-opacity: 0; */
}

You basically just need to step through all nodes that are inside the choicebox to be able to manipulate the arrow. 基本上,您只需要逐步浏览选择框内的所有节点即可操纵箭头。

If you need any further information i will provide it if i can :) 如果您需要任何其他信息,我会在可能的情况下提供:)

Hope it helps, 希望能帮助到你,
Laurenz Laurenz

EDIT: that's the full solution: 编辑:这是完整的解决方案:

.choice-box > .open-button > .arrow{
    -fx-opacity: 0;
}

.choice-box{
    -fx-background-color: transparent;
}

EDIT2: how to use css on nodes with applied id/class? EDIT2:如何在具有已应用ID /类的节点上使用CSS?

    #mycombobox > .open-button > .arrow{
        -fx-opacity: 0;
    }

    #mycombobox{
        -fx-background-color: transparent;
    }

Use with CSS class: 与CSS类一起使用:

    .mycombobox > .open-button > .arrow{
        -fx-opacity: 0;
    }

    .mycombobox{
        -fx-background-color: transparent;
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM