FontAwesomeFX 8.3 is there!

FontAwesomeFX 8.3 comes with extended CSS support.

Introducing two new CSS Properties to set the glyph name and size via stylesheet, while the value for the name and the value for the glyph size follows the common JavaFX CSS type definition:

-glyph-name: <string>
-glyph-size: <size>

You can now set all icon properties via CSS only:

/*
 .thumbs-up-icon{
   -glyph-name: "THUMBS_UP";
   -glyph-size: 6em;
 }

 .thumbs-down-icon{
   -glyph-name: "THUMBS_DOWN";
   -glyph-size: 6em;
 }
 */
FontAwesomeIcon thumbsUpIcon = new FontAwesomeIcon();
thumbsUpIcon.setStyleClass("thumbs-up-icon");

FontAwesomeIcon thumbsDownIcon = new FontAwesomeIcon();
thumbsDownIcon.setStyleClass("thumbs-down-icon");

updown

CSS style class support is also very handy when used in SceneBuilder or in FXML:

updownsb

<HBox>
  <children>
    <FontAwesomeIcon styleClass="thumbs-up-icon" />
    <FontAwesomeIcon styleClass="thumbs-down-icon" />
  </children>
</HBox>

Get 8.3:
Download Binaries: Download
Sources available at Bitbucket

Maven:

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

Leave a Reply to Peter Rogge Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

5 thoughts on “FontAwesomeFX 8.3 is there!”

  1. Hi Jens,
    switch from 8.2 to 8.3 in my project leads to the error:
    Exception in thread “JavaFX Application Thread” java.lang.IllegalAccessError: tried to access method com.sun.javafx.css.parser.CSSParser.()V from class de.jensd.fx.glyphs.GlyphIcon
    at de.jensd.fx.glyphs.GlyphIcon.(GlyphIcon.java:218)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
    at java.lang.Class.newInstance(Class.java:438)
    at sun.reflect.misc.ReflectUtil.newInstance(ReflectUtil.java:51)
    at javafx.fxml.FXMLLoader$InstanceDeclarationElement.constructValue(FXMLLoader.java:1001)
    at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:742)
    at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2701)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2521)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2435)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2403)
    at com.airhacks.afterburner.views.FXMLView.loadSynchronously(FXMLView.java:91)
    at com.airhacks.afterburner.views.FXMLView.initializeFXMLLoader(FXMLView.java:100)
    at com.airhacks.afterburner.views.FXMLView.getPresenter(FXMLView.java:179)
    at de.pro.dbw.navigation.history.impl.listview.childdreamelement.ChildDreamElementView.getRealPresenter(ChildDreamElementView.java:28)

    Switching back works again.

    Greetings Peter

  2. I can’t seem to get -glyph-name and -glyph-size to work, v8.4. I am able to change the color via -fx-fill but the -glyph_8 CSS properties are being ignored.

    1. So you are using fontawesomefx-8.4?
      How did you try to assign the css styles? Did you had a look at the code of my examples, e.g. ‘de.jensd.fx.glyphs.testapps.App’?

  3. Is it possible to create stacked icons using strictly CSS? This new feature with glyph-name selection is very useful, and I’d like to be able to create more varied icons using stacked icons, like we can do in the code.