Validation Support

Dirk Lemmermann dlemmermann at gmail.com
Wed Sep 24 14:00:22 UTC 2025


Hi,

I was just wondering if any thought has been put into providing a standard approach to validating input? Something like ValidatorFX for example [1]? There have been attempts at solving this in ControlsFX but that one was too heavily bound to the actual controls while ValidatorFX works on anything that is observable. I have been using it now for several years in our CRM desktop application and I feel like it is striking a perfect balance between being flexible and easy to use.

Small / incomplete example:

	TextField userTextField = new TextField();

	Validator validator = new Validator();
        validator.createCheck()
          .dependsOn("username", userTextField.textProperty())
          .withMethod(c -> {
	            String userName = c.get("username");
        	    if (!userName.toLowerCase().equals(userName)) {
             		 c.error("Please use only lowercase letters.");
            		}
          	})
          .decorates(userTextField)
          .immediate();

I know that one can easily say “just use the library” but I think that not everybody will find it and it also is nice to have a standard way of doing things.

Dirk

[1] https://github.com/effad/ValidatorFX

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250924/f9bf9815/attachment.htm>


More information about the openjfx-dev mailing list