mimoguz / layeredfonticon   0.2.0

Apache License 2.0 GitHub

A very basic layered font icon utility for Java Swing.

Scala versions: 3.x

Layered Font Icon Support For Java Swing / FlatLaf

For the version 0.2.0 readme, please check the scala-version branch.

Latest Version

This is a very basic multi-layer icon font utility that I extracted from another project of mine, for Java 17+. It lets you use your own font icons in Swing applications, optionally with multiple layers in one icon. Below screenshot shows several examples using the same three layers.

Screenshot

Another example that shows how "unset" colors change with the foreground color:

Screenshot

Layers can also take their colors from the UIManager, using a key. This is especially useful when using FlatLaf, which lets you define such key-value pairs in the properties files. For example, let's assume we have two themes, light and dark.

In DarkTheme.properties:

Theme.accent = #33A1FD

In LightTheme.properties:

Theme.accent = #DF2935

We can now use "Theme.accent" to lookup colors.

Layer.of(Symbol.CUT_ACCENT.text(), "Theme.accent")

Screenshot

Animated theme change in FlatLaf:

Animated transition with FlatLaf

To see how to use, please check the demos, and documentation comments in the

files.

The layeredfonticon project offers Java Swing support without any other dependencies. The layeredfonticon-flat project adds a little better support for the magnificent FlatLaf look and feel.

Basic usage

Maven

In pom.xml, add

<dependencies>
    <dependency>
        <groupId>io.github.mimoguz</groupId>
        <artifactId>layeredfonticon</artifactId>
        <version>0.3.0</version>
    </dependency>
</dependencies>

to use the base version, or

<dependencies>
    <dependency>
        <groupId>io.github.mimoguz</groupId>
        <artifactId>layeredfonticon</artifactId>
        <version>0.3.0</version>
    </dependency>
    <dependency>
        <groupId>io.github.mimoguz</groupId>
        <artifactId>layeredfonticon-flat</artifactId>
        <version>0.3.0</version>
    </dependency>
</dependencies>

to use FlatLaf specific version.