To iconify my application i decided to use ControlFX's Font awesome support.
I tried to use it in both Code and FXML, and the result only to "GEAR" icon that works.
So, what makes other icon not showing up ?
her is the code for FXML file :
<?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>
I want also to change the color of the icon after getting it work.
It seems you want two graphics in one JavaFX Button element. According to the docs, this is not possible.
The button control can contain text and/or a graphic.
The Button class' methods also indicate that at most, only one graphic can be set to a button.
Given the inherent, semantic difference between 'GEAR' and 'SEARCH', I believe you may want two buttons. Try:
...
<children>
<Button mnemonicParsing="false" text="Button" >
<graphic>
// the gear graphic
<Glyph fontFamily="FontAwesome" icon="GEAR"/>
</graphic>
</Button>
<Button mnemonicParsing="false" text="Search" >
<graphic>
// the search graphic
<Glyph fontFamily="FontAwesome" icon="SEARCH"/>
</graphic>
</Button>
</children>
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With