Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

FontAwesomeFX Usage Guide

FontAwesomeFX adds Font Awesome icon nodes to Aussom under fx.fontawesome. It is useful when you want scalable UI icons without shipping a separate image file for each button, menu item, or status indicator.

The wrapper surface is intentionally small:

  • fontawesome.names()
  • fontawesome.icon(string Name)
  • fontawesome.iconView(string Name, string Size = null)
  • FaIconView

What It Is Good For

  • button and toolbar icons
  • status indicators
  • compact menu graphics
  • scalable icons that follow text color and CSS styling

Getting Started

Include the module and any JavaFX controls you want to decorate:

include fx;
include fx.Color;
include fx.Button;
include fx.fontawesome.fontawesome;

Example 1: Standalone Icon View

include fx;
include fx.Color;
include fx.fontawesome.fontawesome;

app = fx.fxApp("Font Awesome", 300, 220);

red = new Color("#E53E3E");

icon = fontawesome.iconView("CAMERA", "28px");
icon.setFill(red);
icon.setId("cameraIcon");

app.setLayout(icon);
app.show(true);
fx.shutdown();

Example 2: Button With Icon

This example creates a button and attaches a Font Awesome icon as the button graphic using the wrapped Java node.

include fx;
include fx.Color;
include fx.Button;
include fx.fontawesome.fontawesome;

app = fx.fxApp("Save Button", 320, 200);

blue = new Color("#3182CE");

icon = fontawesome.iconView("SAVE", "20px");
icon.setFill(blue);

btn = new Button("Save");
btn.obj.invoke("setGraphic", icon.obj);

app.setLayout(btn);
app.show(true);
fx.shutdown();

Example 3: Icon Discovery Helper

If you do not remember the exact enum name, inspect the available names first.

include fx.fontawesome.fontawesome;

names = fontawesome.names();
for (name : names) {
    if (name.startsWith("CAM")) {
        c.log(name);
    }
}

Then use the exact enum value:

icon = fontawesome.iconView("CAMERA", "24px");

Tips and Gotchas

  • Font Awesome icon names are enum names, so they must match exactly. Use fontawesome.names() if you are unsure.
  • fontawesome.iconView(...) is the easiest common path. Use FaIconView directly when you want to wrap an existing Java object or build a node first and configure it later.
  • Size values use the FontAwesomeFX string format, such as 20px or 1.4em.
  • To use an icon as the graphic for another JavaFX control, pass icon.obj through AJI to the JavaFX setter, for example: btn.obj.invoke("setGraphic", icon.obj).
  • FontAwesomeFX is for icon glyphs only. If you need the ControlsFX glyph registry wrapper, use fx.controlsfx.FontAwesome.