install4j Help

Look & Feel

The GUI of the installer, uninstaller and other installer applications is implemented with Java Swing. Swing is themeable and so install4j can offer you choices for the look and feel of the the applications that are provided by the runtime. The generated launchers are not affected by these settings.

Configuring the look & feel

The options for the look & feel can be adjusted on the "Installer->Screens & Actions->Look & Feel" step.

The default setting is to use the FlatLaf cross platform Look and Feel which is a flat Look and Feel that works well on all supported platforms and includes a dark mode. Please consider starring it on GitHub as a token of appreciation for the author.

FlatLaf includes four built-in themes, two for light mode and two for dark mode. By default, the themes that look like the IntelliJ IDEA light and dark themes are selected. In addition, FlatLaf supports custom IntelliJ themes. These are based on JSON files and can override UI colors. You can download an IntelliJ theme from the JetBrains plugin repository and add its JAR files on the "Installer->Screens & Actions->Custom Code" step. If the themes plugin is packaged in a ZIP file, you have to extract the ZIP file and add the contained JAR files instead. The contained themes will then show up in the chooser dialog.

On Windows 10+ and macos 10.14+, the runtime detects whether dark mode is being used and activates it automatically. If the user switches between light and dark mode, the runtime adjusts to it on the fly. The look and feel configuration offers options to prevent this auto-detection and use either light or dark mode.

For backwards compatibility, you can also select the "Java native look and feel". This is a look and feel that is included the JRE and tries to mimic the native widgets of the operating system with varying success. In some instances, this look and feel may seem out of place as it shows the UI from an older version of the operating system. Also, HiDPI resolutions may not be well supported by this look and feel. For these reasons, using the native look and feel is discouraged and the FlatLaf cross-platform look and feel is recommended instead.

Using a custom look and feel

You can apply your own look and feel by extending the com.install4j.api.laf.LookAndFeelHandler class in the install4j API. After adding the compiled class and its dependencies on the "Installer->Screens & Actions->Custom Code" step, you can select the class in the chooser dialog.

The com.install4j.api.laf.LookAndFeelHandler implements the com.install4j.api.laf.LookAndFeelEnhancer interface that contains methods that help with certain aspects of creating the UI. You can override these methods to change their default behavior.

For example, a tri-state check box is required by the UI of installer applications. Java Swing does not include such a component, but some look and feels add this feature. To avoid using a generic simulation of a tri-state checkbox, the createTriStateCheckbox method can be overridden in your implementation of the com.install4j.api.laf.LookAndFeelHandler.