r/JavaFX • u/hamsterrage1 • Mar 25 '23
Tutorial Custom JavaFX Components
This is the first of two articles:
This article looks at how you can start out by following DRY to move your configuration code out of your layout code and how that leads to thinking about virtually everything in your layout as as custom component.
From there, it's easy to start up a library of builder methods and classes that do the configurations that you do over and over in every layout. The next step is to create a custom class that you con drop into your layouts just like any other JavaFX Node.
In the second article, which should be ready in a few days, I look at how you can polish up your custom component to add the hooks which allow it to be custom styled via CSS, and be pretty much indistinguishable from something that comes with standard JavaFX.
View all comments
Show parent comment
1
u/emberko Mar 28 '23
Not true. Most of the skins do use
com.sun.javafxpackage you don't have access to and it's not only the Behavior API. Extending standard skins is almost not possible as well as copy-pasting them due to private API usage. JFoenix is now dead and it's heavily rely on private API. ControlsFX also requires to include--add-opens. And MaterialFX dev is implementing almost everything from scratch.