2

Introduction

I am trying to build a JavaFX gui inspired by the demo of JFoenix from their github page. The demo uses a few outdated dependencies and one of those dependencies is the FontAwesomeFX library (link to the fontawesome page).

Description of the issue

I ran into issues after updating the demo version of fontawesomefx-8.0.10.jar (a link to the lib folder here) to version 8.9.

I am using the following FontAwesomeFX dependency in my pom:

    <dependency>
        <groupId>de.jensd</groupId>
        <artifactId>fontawesomefx</artifactId>
        <version>8.9</version>
    </dependency>

In the original main.fxml (link here) a font awesome icon is added to the graphic container of a label:

<JFXPopup fx:id="toolbarPopup" styleClass="tool-bar-popup">
        <JFXListView styleClass="option-list-view">
            <Label>
                Contact Us
                <graphic>
                    <Icon awesomeIcon="USER" size="1.5em" style=";"
                        styleClass="option-jfx-list-view-icon" />
                </graphic>
            </Label>
            <Label fx:id="exit">
                Exit
                <graphic>
                    <Icon awesomeIcon="REPLY" size="1.5em" style=";"
                        styleClass="option-jfx-list-view-icon" />
                </graphic>
            </Label>
        </JFXListView>
    </JFXPopup>

Due to incompatible classes after updating the version to 8.9 I changed the FXML to this:

<JFXPopup fx:id="toolbarPopup" styleClass="tool-bar-popup">
        <JFXListView styleClass="option-list-view">
            <Label>
                Contact Us
                <graphic>
                    <FontAwesomeIconView glyphName="USER" size="1.5em" style=";" styleClass="option-jfx-list-view-icon" />
                </graphic>
            </Label>
            <Label fx:id="exit">
                Exit
                <graphic>
                    <FontAwesomeIconView glyphName="REPLY" size="1.5em" style=";" styleClass="option-jfx-list-view-icon" />
                </graphic>
            </Label>
        </JFXListView>
    </JFXPopup>

There are no compile issues, the main.fxml can be loaded into scenebuilder (that is, if scene builder has the 8.9 jar from fontawesome and the jfoenix.jar added to its library).

However, the icons are not showing correctly as shown in this small screen capture:

enter image description here

The first icon should be an user and the second icon should be an arrow back (or a "reply'ish" arrow).

Question

Given above situation, what is the correct FXML syntax to add a graphic to a label using FontAwesomeFX version 8.9?

Sander_M
  • 1,109
  • 2
  • 18
  • 36
  • I do have the same issue. how to resolve this? – Master Po Jun 26 '17 at 11:35
  • 1
    Just found it out. It was using the Roboto font. In **jfoenix-main-demo.css** commented out this font family style class `.root { -fx-font-family: "Roboto"; } and I'm able to see the fa icons now.` – Master Po Jun 26 '17 at 14:53
  • Feels free to post it as answer as it is indeed the reason for the weird font – Sander_M Jun 26 '17 at 20:21

0 Answers0