为了使我的应用程序图标化,我决定使用 ControlFX 的 Font Awesome 支持。
我尝试在 Code 和 FXML 中都使用它,结果只显示“GEAR”图标有效。
那么,是什么让其他图标不显示?
她是 FXML 文件的代码:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.layout.AnchorPane?>
<?import org.controlsfx.glyphfont.Glyph?>
<fx:root maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" type="AnchorPane" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="testController">
<children>
<Button mnemonicParsing="false" text="Button" >
<graphic>
// The Gear icon works perfectly
<Glyph fontFamily="FontAwesome" icon="GEAR"/>
<Glyph fontFamily="FontAwesome" icon="SEARCH"/>
</graphic>
</Button>
</children>
</fx:root>
我还想在让它工作后改变图标的颜色。