简体   繁体   中英

How to style FontAwesomeIconView using stylesheets .css? JavaFX

I have following code:

private Hyperlink hyperlink = new Hyperlink();
private FontAwesomeIconView fontawesome = new FontAwesomeIconView(FontAwesomeIcon.TIMES);
hyperlink.setGraphic(fontawesome);

And now i have problem. I need to change css of my FontAwesome icon dynamically. So i need to use stylesheet instead of using method like:

fontawesome.setScaleX(0.65);
fontawesome.setScaleY(0.65);
fontawesome.setTranslateX(-1.0);
fontawesome.setFill(Color.WHITE);

I tried something like that:

.root {
    -icons-color: red;
}

.glyph-icon {
    -fx-font-family: "FontAwesome";
    -icons-color: red;
}

but it is not working:(
Anyone can tell me how i can style my icons inside css file?

Well my fix was something like that:

.glyph-icon {
    -fx-fill: #b45959;
}

i just need to use -fx-fill to change color instead of -icons-color

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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