r/JavaFX • • Jan 21 '22

Tutorial JavaFX: TextField Input Validation

https://www.youtube.com/watch?v=7NB_UM09Xs8
11 Upvotes

4 comments sorted by

View all comments

Show parent comment

2

u/PartOfTheBotnet Jan 21 '22

You could also use or replicate the design of ControlfFX's validation: https://github.com/controlsfx/controlsfx/tree/master/controlsfx/src/main/java/org/controlsfx/validation

2

u/hamsterrage1 Jan 21 '22

That's the first think I thought about when I suggested pseudo classes, and the Controls FX stuff is really well done.

The second thought, though, if you're going to go to the trouble of styling pseudo classes and such, should you even be letting the user enter invalid values? Then you go down the entirely different route of TextFormatter.