1. Introduction

Ikonli provides icon packs that can be used in Java applications. Currently Swing and JavaFX UI toolkits are supported.

1.1. Download

Ikonli and all of its icon packs can be downloaded from Maven Central ikonli core.

You must select a binary that matches your target UI toolkit, such as

Swing

ikonli-swing-12.3.1 (JDK 11+) or ikonli-swing-2.6.0 (JDK 8)

JavaFX

ikonli-javafx-12.3.1 (JDK 11+) or ikonli-javafx-2.6.0 (JDK 8)

Not all icon packs are available in the JDK8 only version (2.6.0).

Next, select any of the icon packs you want to use. You may select more than one for the same application.

1.2. Breaking Changes

If you are upgrading to 12.0.0 or later be aware of the following changes:

  • The module names moved from org.kordamp.iconli to org.kordamp.ikonli.*.

  • The icon-hawkconsfilled-pack and icon-hawkconsstroke-pack icon packs were merged into a single icon-hawkcons-pack icon pack.

  • The method getCode() of org.kordamp.ikonli.Ikon now returns int instead of char. This change is needed to accomodate icon packs whose icon codes are larger than a single char, such as MaterialDesign.

  • The interface org.kordamp.ikonli.IkonHandler no longer has a method String getFontResourcePath(); it has two new methods instead: URL getFontResource() and InputStream getFontResourceAsStream().

2. Usage

2.1. Swing

The ikonli-swing:12.3.1 JAR provides a new Icon class: org.kordamp.ikonli.swing.FontIcon. You may use this class with any Swing component that supports an Icon property.

2.1.1. Installing

gradle
repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.kordamp.ikonli:ikonli-swing:12.3.1'
}
maven
<dependencies>
    <dependency>
        <groupId>org.kordamp.ikonli</groupId>
        <artifactId>ikonli-swing</artifactId>
        <version>12.3.1</version>
    </dependency>
</dependencies>

2.2. JavaFX

The ikonli-javafx:12.3.1 JAR provides a new Node class: org.kordamp.ikonli.javafx.FontIcon. You may use this class with any JavaFX control that accepts a graphic property. You may also use the icon directly as it is a subclass of javafx.scene.text.Text. The icon class can be used inside an FXML file too.

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.Button?>
<?import javafx.scene.layout.GridPane?>
<?import org.kordamp.ikonli.javafx.FontIcon?>

<GridPane prefHeight="60.0" prefWidth="200.0"
          xmlns:fx="http://javafx.com/fxml"
          fx:controller="org.example.AppController">
    <Button GridPane.columnIndex="0" GridPane.rowIndex="0"
            mnemonicParsing="false"
            prefWidth="200.0">
        <graphic>
            <FontIcon iconLiteral="di-java" iconSize="64"/>
        </graphic>
    </Button>
</GridPane>
Icon Literal Syntax

The iconLiteral property accepts any of these formats

  • icon-code

  • icon-code:icon-size

  • icon-code:icon-size:icon-color

where the following rules apply

icon-code

An icon code literal such as di-java. The prefix (di-) indicates the icon pack. For this example, DevIcons needs to be installed.

icon-size

A number (in pixels) specifying the width of the icon.

icon-color

A javafx.scene.paint.Color, javafx.scene.paint.LinearGradient, or javafx.scene.paint.RadialGradient literal.

Examples
di-java
di-java:32
di-java:64:BLUE
Stylable Properties

org.kordamp.ikonli.javafx.FontIcon exposes properties that can be styled using CSS. It defines a node class named ikonli-font-icon.

-fx-icon-code

An icon literal such as di-java or fa-github.

-fx-icon-size

The size of the icon, in pixels.

-fx-icon-color

A JavaFX Paint definition, such as a plain color or gradient.

A stackable version is also available, org.kordamp.ikonli.javafx.StackedFontIcon. This is an specialized version of javafx.scene.layout.StackPane that accepts instances of org.kordamp.ikonli.javafx.FontIcon as child content. You may use this class with FXML, like it’s shown in the following example

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.layout.GridPane?>
<?import org.kordamp.ikonli.javafx.FontIcon?>
<?import org.kordamp.ikonli.javafx.StackedFontIcon?>

<GridPane prefHeight="60.0" prefWidth="200.0"
          xmlns:fx="http://javafx.com/fxml"
          fx:controller="org.example.AppController">
    <StackedFontIcon GridPane.columnIndex="0" GridPane.rowIndex="0" iconSize="48">
        <FontIcon iconLiteral="fa-circle-thin" iconColor="red"/>
        <FontIcon iconLiteral="fa-camera" StackedFontIcon.iconSize="0.5"/>
    </StackedFontIcon>
</GridPane>
Stylable Properties

org.kordamp.ikonli.javafx.StackedFontIcon exposes properties that can be styled using CSS. It defines a node class named stacked-ikonli-font-icon.

-fx-icon-size

The size of the icon, in pixels.

-fx-icon-color

A JavaFX Paint definition, such as a plain color or gradient.

2.2.1. Installing

gradle
repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.kordamp.ikonli:ikonli-javafx:12.3.1'
}
maven
<dependencies>
    <dependency>
        <groupId>org.kordamp.ikonli</groupId>
        <artifactId>ikonli-javafx</artifactId>
        <version>12.3.1</version>
    </dependency>
</dependencies>

Next, don’t forget to add entries to your module descriptor (module-info.java). Here’s for example the minimum settings required for a JavaFX application

module-info.java
module com.acme.demo {
    requires javafx.base;
    requires javafx.graphics;
    requires javafx.controls;
    requires org.kordamp.ikonli.core;
    requires org.kordamp.ikonli.javafx;
    // add icon pack modules
    requires org.kordamp.ikonli.fontawesome;
}

2.3. Creating a Fat JAR

Ikonli’s icon packs rely on services files to provide their implementation. You must make sure that those services files are properly merged when creating a Fat JAR or Uber JAR and your application does not use the modulepath. Fortunately there are build plugins that can help with this task.

Gradle

Configure the shadow plugin and merge service files

build.gradle
plugins {
    id 'com.github.johnrengelman.shadow' version '6.1.0'
}

shadowJar {
    mergeServiceFiles()
}
Maven

Configure the maven-shade-plugin and apply the org.apache.maven.plugins.shade.resource.ServicesResourceTransformer transformer.

pom.xml
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>3.2.4</version>
    <configuration>
        <transformers>
            <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
        </transformers>
    </configuration>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
        </execution>
    </executions>
</plugin>

2.4. BOM

Starting with version 12.0.0 Ikonli offers a BOM for all core projects and icon packs. You may configure it with either Gradle or Maven.

gradle
repositories {
    mavenCentral()
}

dependencies {
    implementation platform('org.kordamp.ikonli:ikonli-bom:12.3.1')
    implementation 'org.kordamp.ikonli:ikonli-javafx'
    implementation 'org.kordamp.ikonli:ikonli-fontawesome5-pack'
}
maven
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.kordamp.ikonli</groupId>
            <artifactId>ikonli-bom</artifactId>
            <version>12.3.1</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>
<dependencies>
    <dependency>
        <groupId>org.kordamp.ikonli</groupId>
        <artifactId>ikonli-javafx</artifactId>
    </dependency>
    <dependency>
        <groupId>org.kordamp.ikonli</groupId>
        <artifactId>ikonli-fontawesome5-pack</artifactId>
    </dependency>
</dependencies>

3. Icon Packs

3.1. AntDesignIcons

3.1.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-antdesignicons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-antdesignicons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.2. Bootstrapicons

3.2.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-bootstrapicons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-bootstrapicons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.3. Boxicons

3.3.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-boxicons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-boxicons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.4. Bpmn

3.4.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-bpmn-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-bpmn-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.5. Captainicon

3.5.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-captainicon-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-captainicon-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.6. Carbonicons

3.6.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-carbonicons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-carbonicons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.7. Codicons

3.7.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-codicons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-codicons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.8. CoreUI

3.8.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-coreui-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-coreui-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.9. DashIcons

3.9.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-dashicons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-dashicons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.10. DevIcons

3.10.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-devicons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-devicons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.11. Elusive

3.11.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-elusive-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-elusive-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.12. Entypo

3.12.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-entypo-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-entypo-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.13. EvaIcons

3.13.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-evaicons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-evaicons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.14. Feather

3.14.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-feather-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-feather-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.15. FileIcons

3.15.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-fileicons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-fileicons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.16. FluentUI

3.16.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-fluentui-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-fluentui-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.17. FontAwesome (Legacy)

3.17.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-fontawesome-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-fontawesome-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.18. FontAwesome5 (Latest)

3.18.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-fontawesome5-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-fontawesome5-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.19. Fontelico

3.19.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-fontelico-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-fontelico-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.20. Foundation

3.20.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-foundation-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-foundation-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.21. Hawcons

3.21.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-hawcons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-hawcons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.22. Icomoon

3.22.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-icomoon-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-icomoon-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.23. Ionicons (Legacy)

3.23.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-ionicons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-ionicons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.24. Ionicons 4 (Latest)

3.24.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-ionicons4-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-ionicons4-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.25. Jam

3.25.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-jamicons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-jamicons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.26. Ligature Symbols

3.26.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-ligaturesymbols-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-ligaturesymbols-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.27. LineAwesome

3.27.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-lineawesome-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-lineawesome-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.28. Linecons

3.28.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-linecons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-linecons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.29. Maki (Legacy)

3.29.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-maki-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-maki-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.30. Maki2 (Latest)

3.30.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-maki2-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-maki2-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.31. Mapicons

3.31.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-mapicons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-mapicons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.32. Material Icons (Legacy)

3.32.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-material-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-material-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.33. Material2 Icons (Latest)

3.33.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-material2-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-material2-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.34. MaterialDesign (Legacy)

3.34.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-materialdesign-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-materialdesign-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.35. MaterialDesign2 (Latest)

3.35.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-materialdesign2-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-materialdesign2-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.36. Medicons

3.36.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-medicons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-medicons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.37. Metrizeicons

3.37.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-metrizeicons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-metrizeicons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.38. Microns

3.38.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-microns-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-microns-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.39. Ociicons

3.39.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-ociicons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-ociicons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.40. Octicons

3.40.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-octicons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-octicons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.41. OpenIconic

3.41.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-openiconic-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-openiconic-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.42. Payment Font

3.42.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-paymentfont-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-paymentfont-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.43. PrestaShop Icons

3.43.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-prestashopicons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-prestashopicons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.44. Remixicon

3.44.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-remixicon-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-remixicon-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.45. RunestroIcons

3.45.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-runestroicons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-runestroicons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.46. SimpleIcons

3.46.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-simpleicons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-simpleicons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.47. SimpleLineIcons

3.47.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-simplelineicons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-simplelineicons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.48. Subway

3.48.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-subway-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-subway-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.49. Themify

3.49.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-themify-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-themify-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.50. Typicons

3.50.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-typicons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-typicons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.51. Unicons

3.51.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-unicons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-unicons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.52. Weathericons

3.52.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-weathericons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-weathericons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.53. Websymbols

3.53.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-websymbols-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-websymbols-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.54. Whhg

3.54.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-whhg-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-whhg-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.55. Win10

3.55.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-win10-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-win10-pack</artifactId>
    <version>12.3.1</version>
</dependency>

3.56. Zondicons

3.56.1. Installing

gradle
implementation 'org.kordamp.ikonli:ikonli-zondicons-pack:12.3.1'
maven
<dependency>
    <groupId>org.kordamp.ikonli</groupId>
    <artifactId>ikonli-zondicons-pack</artifactId>
    <version>12.3.1</version>
</dependency>

4. Authoring

Follow these steps to create and register custom icons.

4.1. Define an Ikon class

Create an Enum that implements the org.kordamp.ikonli.Ikon type. Each enum entry should define the icon’s description and code. Make sure to use a unique prefix in the description, for example

MyIcon.java
package com.acme.mine;

import org.kordamp.ikonli.Ikon;

public enum MyIcon implements Ikon {
    ICON_NAME("my-icon-name", '\ue600');

    public static MyIcon findByDescription(String description) {
        for (MyIcon font : values()) {
            if (font.getDescription().equals(description)) {
                return font;
            }
        }
        throw new IllegalArgumentException("Icon description '" + description + "' is invalid!");
    }

    private String description;
    private int code;

    MyIcon(String description, int code) {
        this.description = description;
        this.code = code;
    }

    @Override
    public String getDescription() {
        return description;
    }

    @Override
    public int getCode() {
        return code;
    }
}

4.2. Define an Ikon handler

Implement the org.kordamp.ikonli.IkonHandler interface.

MyIconIkonHandler.java
package com.acme.mine;

import org.kordamp.ikonli.AbstractIkonHandler;
import org.kordamp.ikonli.Ikon;
import org.kordamp.ikonli.IkonHandler;
import org.kordamp.jipsy.annotations.ServiceProviderFor;
import java.io.InputStream;
import java.net.URL;

@ServiceProviderFor(IkonHandler.class)                                 (1)
public class MyIconIkonHandler extends AbstractIkonHandler {
    private static final String FONT_RESOURCE = "/META-INF/resources/myicon/1.2.3/fonts/myicon.ttf";

    @Override
    public boolean supports(String description) {
        return description != null && description.startsWith("my-");   (2)
    }

    @Override
    public Ikon resolve(String description) {
        return MyIcon.findByDescription(description);
    }

    @Override
    public URL getFontResource() {
        return getClass().getResource(FONT_RESOURCE);                  (3)
    }

    @Override
    public InputStream getFontResourceAsStream() {
        return getClass().getResourceAsStream(FONT_RESOURCE);          (3)
    }

    @Override
    public String getFontFamily() {
        return "MyIcon-Font";                                          (4)
    }
}
1 Generates an entry at META-INF/services/org.kordamp.ikonli.IkonHandler.
2 Note the use of the icon prefix.
3 Locate the font resource.
4 Name of the font family.

The use of the @ServiceProviderFor annotation requires having jipsy configured as an annotation processor. You may skip this dependency and manually create the service file yourself. You must provide a service entry if the icon is to be consumed in the classpath, as not everyone uses the modulepath.

META-INF/services/org.kordamp.ikonli.IkonHandler
com.acme.mine.MyIconIkonHandler

4.3. Define an Ikon provider

Implement the org.kordamp.ikonli.IkonProvider interface.

MyIconIkonProvider.java
package com.acme.mine;

import org.kordamp.ikonli.IkonProvider;
import org.kordamp.jipsy.annotations.ServiceProviderFor;

@ServiceProviderFor(IkonProvider.class)                                (1)
public class MyIconIkonProvider implements IkonProvider<MyIcon> {
    @Override
    public Class<MyIcon> getIkon() {
        return MyIcon.class;
    }
}
1 Generates an entry at META-INF/services/org.kordamp.ikonli.IkonProvider.

The use of the @ServiceProviderFor annotation requires having jipsy configured as an annotation processor. You may skip this dependency and manually create the service file yourself. You must provide a service entry if the icon is to be consumed in the classpath, as not everyone uses the modulepath.

META-INF/services/org.kordamp.ikonli.IkonProvider
com.acme.mine.MyIconIkonProvider

4.4. Configure the module descriptor (Optional)

If you’re building a Java module then you must register the previous implementations in a module descriptor

module-info.java
module com.acme.mine {
    requires org.kordamp.ikonli.core;
    requires static org.kordamp.jipsy.annotations;                     (1)
    exports com.acme.mine;

    provides org.kordamp.ikonli.IkonHandler
        with com.acme.mine.MyIconIkonHandler;
    provides org.kordamp.ikonli.IkonProvider
        with com.acme.mine.MyIconIkonProvider;
}
1 Needed only if you use jipsy.