New kid on the blog: FormsFX

I am very happy to announce the immediate availability of FormsFX, a framework for (surprise!) creating forms in JavaFX. FormsFX is the result of a student project at the “Fachhochschule Nordwestschweiz” (FHNW) in Switzerland. The project was initiated and sponsored by me. I believe that the result of this project is of high quality and that other projects should be able to benefit from it, hence I am contributing it as an open source project to the Java community today.

The source code and documentation can be found on GitHub at this location:

A binary distribution (JAR file) can be downloaded from my website.


The design and the implementation were done by Sacha Schmid and Rinesch Murugathas as part of their studies for their bachelor degree.

View, Model View, Model

The form renderer of FormsFX will automatically create a form for you based on a view model. The view model defines bindings to the properties of the domain model / business model. The renderer utilises a twelve column layout (similar to bootstrap). Labels and their fields can be placed on one or more of those columns. Each field defines its own column span. If there is not enough space left for a field then it will be automatically placed on the next row. The screenshot below shows you the form created by the demo application that ships with FormsFX.


Fluent API

The fluent API of FormsFX allows you to create a view model for a form that consists of several groups and sections. A group and a section can consist of several fields. The difference between a group and a section is simply the additional title property and the fact that sections can be expanded / collapsed. The code below shows how the first three fields of the screenshot above were defined.

[fusion_builder_container hundred_percent=”yes” overflow=”visible”][fusion_builder_row][fusion_builder_column type=”1_1″ background_position=”left top” background_color=”” border_size=”” border_color=”” border_style=”solid” spacing=”yes” background_image=”” background_repeat=”no-repeat” padding=”” margin_top=”0px” margin_bottom=”0px” class=”” id=”” animation_type=”” animation_speed=”0.3″ animation_direction=”left” hide_on_mobile=”no” center_content=”no” min_height=”none”]

Form form = Form.of(
                     .validate(StringLengthValidator.atLeast(2, "country_error_message")),
                     .validate(StringLengthValidator.exactly(2, "ISO_3166_error_message")),
        )).title("My Form").i18n(resourceBundle);


The following things can be defined for each field:

  • the type (string, number, boolean, ….)
  • a label
  • a placeholder text
  • whether the field is required
  • one or more validators
  • a tooltip
  • a column span
  • a format (e.g. decimal numbers)
  • a renderer (normally default used, e.g. textfield for text)
  • single- or multiline
  • editable or not
  • CSS style classes
  • an ID


Any form can also be associated with a resource bundle. This allows the application to switch field labels on the fly.

So please take FormsFX for a spin and let us know what you think.

Happy coding everyone![/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s