Preference dialogs for business applications made easy. Creating preference dialogs in Java has never been this easy!

To use this framework as part of your Maven build simply add the following dependency to your pom.xml file:
<dependency> <groupId>com.dlsc.preferencesfx</groupId> <artifactId>preferencesfx-core</artifactId> <version>8.6.0</version> </dependency>
<dependency> <groupId>com.dlsc.preferencesfx</groupId> <artifactId>preferencesfx-core</artifactId> <version>11.8.0</version> </dependency>
To use this framework as part of your gradle build simply add the following to your build.gradle file and use the following dependency definition:
dependencies { compile group: 'com.dlsc.preferencesfx', name: 'preferencesfx-core', version: '8.6.0' }
dependencies { compile group: 'com.dlsc.preferencesfx', name: 'preferencesfx-core', version: '11.8.0' }
Creating preference dialogs in JavaFX is a tedious and very error-prone task. PreferencesFX is a framework which solves this problem. It enables the developer to create preference dialogs with ease and creates well-designed and user-friendly preference dialogs by default.

| Nr. | Feature | Description |
|---|---|---|
| 1 | Search / Filter | Filters all categories for a given String. Enables searching for a Setting, Group or Category by name. |
| 2 | TreeView | Shows all categories in a hierarchical structure |
| 3 | Breadcrumb Bar | Shows the user the previous categories in the hierarchy to the currently displayed category and allows the user to navigate back. |
| 4 | Undo / Redo Buttons | Allows the user a stepwise undo and redo possibility of his last changes. |
| 5 | Various pre-defined setting types | e.g. Integer, Double, Boolean, String, Lists, Objects |
| 6 | close/cancel buttons | The close button just closes the window and leaves the preferences as they are. The cancel button discards all changes which are made during the time the dialog was last opened. |
Instant persistance | Any changes to the application are saved instantly.This project uses the asciidoctor plugin to generate the necessary documentation. Run the following maven task:
process-resources
Afterwards, you will find the documentation in the target/generated-docs/ subdirectory.
A preferences dialog can contain multiple Categories.
Each Category contains one to multiple Groups
Each Group contains one to multiple Settings
For better illustration, the basic concept of writing a preferences dialog is shown below:
PreferencesFx preferencesFx = PreferencesFx.of(SaveClass.class, Category.of("Category Title", Group.of("Group Title", Setting.of("Setting Title", new Property()) ) ) );
Notes:
Group and declare all settings in a Category directly. However, in this case all settings will simply be displayed one after another without grouping. If you want more control, use Group.Group can also be defined without a title. In this case, the individual groups are displayed with more space in between them, to ensure they can be differentiated.Category can also take a graphic node to be used as an icon as the second argument, e.g. Category.of("Category Title", new ImageView(new Image("file:icon.png")),We created several demos to visualize the capabilities of PreferencesFX.
Simply launch preferencesfx-demo/src/com/dlsc/preferencesfx/AppStarter.java and look into the different Tabs.
The following demos are available:
| Import | Description |
|---|---|
Standard | The standard demo with a few settings and fully working bindings. |
Internationalized | Shows how to define preference dialogs in multiple languages, using internationalization. |
OneCategory | Shows the behavior of the API when only one category is used: The Breadcrumb Bar and TreeView will be omitted from the GUI. |
Extended | A demo, populated with lots of categories, groups and settings without any bindings. Designed to show usage in a big project. |
Creating a preferences dialog is as simple as calling PreferencesFx.of().
StringProperty stringProperty = new SimpleStringProperty("String"); BooleanProperty booleanProperty = new SimpleBooleanProperty(true); IntegerProperty integerProperty = new SimpleIntegerProperty(12); DoubleProperty doubleProperty = new SimpleDoubleProperty(6.5); PreferencesFx preferencesFx = PreferencesFx.of(AppStarter.class, // Save class (will be used to reference saved values of Settings to) Category.of("Category title 1", Setting.of("Setting title 1", stringProperty), // creates a group automatically Setting.of("Setting title 2", booleanProperty) // which contains both settings ), Category.of("Category title 2") .expand() // Expand the parent category in the tree-view .subCategories( // adds a subcategory to "Category title 2" Category.of("Category title 3", Group.of("Group title 1", Setting.of("Setting title 3", integerProperty) ), Group.of( // group without title Setting.of("Setting title 3", doubleProperty) ) ) ) );
This code snippet results in the following preferences window, containing three categories:

To create a Setting, you only need to define a title and a Property. PreferencesFX does the rest.
You can then integrate this Property in your application. Changes of values in the preferences dialog will be persisted instantly, however it's up to you to decide whether you want to persist them instantly in your application as well.
You have a lot of options to influence the behavior and layout of the preferences dialog.
The following parameters are the absolute minimum, needed for the proper functioning of PreferencesFX:
| Parameter | Description |
|---|---|
AppStarter.class | In the constructor of PreferencesFx a saveClass is required. This class is saved as a key for the saved setting values. Further information is available in the javadoc. |
Category description | Each Category must have a description. This is required to display its description in the TreeView. |
Setting description | Each Setting must have a description. It will be displayed on the left of the control, which is used to manipulate the respective Setting. |
Note: The value of the each Setting is stored using the Java Preferences API by default.
For testing purposes, to clear the saved preferences of the demo, run the method in the class:
preferencesfx-demo/src/test/java/PreferencesStorageReset.java
The following parameters are optionally available to further configure the dialog created by PreferencesFX:
| Method | Class | Description |
|---|---|---|
.subCategories | Category | Subcategories allow a Category to have additional subcategories as children. Those are also displayed in the tree. |
.expand | Category | Allows to specify if the Category should be expanded in the Tree-View by default. |
.description | Group | If you decide not to add the description of a group in the constructor, you can still add it after the creation of the group. |
.validate | Setting | Allows to add a Validator to a setting, to set constraints to the values that can be entered. |
.persistApplicationState | PreferencesFx | Defines if the Preferences API should save the application states. This includes the state persistence of the dialog window, as well as the values of each Setting. |
.persistWindowState | PreferencesFx | Defines whether the state of the dialog window (position, size, last selected Category) should be persisted or not. Defaults to false. |
.saveSettings | PreferencesFx | Defines whether the changed settings in the Preferences window should be saved or not. Defaults to true. |
.debugHistoryMode | PreferencesFx | Makes it possible to enable or disable the keycombination to open a debug view of the list of all actions in the history (undo / redo). Pressing Ctrl + Shift + H (Windows) or CMD + Shift + H (Mac) opens a dialog with the undo / redo history, shown in a table. Defaults to false. |
.buttonsVisibility | PreferencesFx | Sets the visibility of the cancel and close buttons in the PreferencesFxDialog. Defaults to true. |
.instantPersistent | PreferencesFx | If set to true, it will instantly apply any changes that are being made in the PreferencesFxDialog. If set to false, it will only apply changes when the Save / Apply / OK button is pressed. Due to a limitation in FormsFX, undo / redo cannot be used with instant persistence switched off! Defaults to true. |
.i18n | PreferencesFx | Sets the translation service of the preferences dialog for internationalization. |
.dialogTitle | PreferencesFx | Allows to specify a custom dialog title. |
.dialogIcon | PreferencesFx | Allows to specify a custom dialog icon. |
The following table shows how to create Settings using the predefined controls and how they look like:
Note: By default, PreferencesFX saves the settings under a key which consists of the breadcrumb to the setting, delimited by # signs. If you want to define your own key to be used for saving, use the method setting.customKey("key")
All displayed strings can be internationalized. You can use resource bundles to define different locales and use the key instead of the descriptions. Adding i18n support is simply done by calling the method .i18n() at the end when creating the preferences:
private ResourceBundle rbDE = ResourceBundle.getBundle("demo.demo-locale", new Locale("de", "CH")); private ResourceBundle rbEN = ResourceBundle.getBundle("demo.demo-locale", new Locale("en", "UK")); private ResourceBundleService rbs = new ResourceBundleService(rbEN); PreferencesFx.of(…) .i18n(rbs);
It is possible to optionally add a Validator to settings. PreferencesFX uses


企业专属的AI法律顾问
iTerms是法大大集团旗下法律子品牌,基于最先进的大语言模型(LLM)、专业的法律知识库和强大的智能体架构,帮助企业扫清合规障碍,筑牢风控防线,成为您企业专属的AI法律顾问。


稳定高效的流量提升解决方案,助力品牌曝光
稳定高效的流量提升解决方案,助力品牌曝光


最新版Sora2模型免费使用,一键生成无水印视频
最新版Sora2模型免费使用,一键生成无水印视频


实时语音翻译/同声传译工具
Transly是一个多场景的AI大语言模型驱动的同声传译、专业翻译助手,它拥有超精准的音频识别翻译能力,几乎零延迟的使用体验和支持多国语言可以让你带它走遍全球,无论你是留学生、商务人士、韩剧美剧爱好者,还是出国游玩、多国会议、跨国追星等等,都可以满足你所有需要同传的场景需求,线上线下通用,扫除语言障碍,让全世界的语言交流不再有国界。


选题、配图、成文,一站式创作,让内容运营更高效
讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。


AI辅助编程,代码自动修复
Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。


最强AI数据分析助手
小浣熊家族Raccoon,您的AI智能助手,致力于通过先进的人工智能技术,为用户提供高效、便捷的智能服务。无论是日常咨询还是专业问题解答,小浣熊都能以快速、准确的响应满足您的需求,让您的生活更加智能便捷。


像人一样思考的AI智能体
imini 是一款超级AI智能体,能根据人类指令,自主思考、自主完成、并且交付结果的AI智能体。


AI数字人视频创作平台
Keevx 一款开箱即用的AI数字人视频创作平台, 广泛适用于电商广告、企业培训与社媒宣传,让全球企业与个人创作者无需拍摄剪辑,就能快速生成多语言、高质量的专业视频。


一站式AI创作平台
提供 AI 驱动的图片、视频生成及数字人等功能,助力创意创作
最新AI工具、AI资讯
独家AI资源、AI项目落地

微信扫一扫关注公众号