Datepicker in Processing

To make this post a bit more useful for others, I will try to explain what JavaFX does.

As I understand it, JavaFX was first developed by Sun Microsystems, then Oracle, and it seems like in the future it will be maintained by the community as OpenJFX. It seems to offer many configurable components to make it easy to create GUIs, style them and add visual effects. JavaFX is supposed to replace Swing. I think the Processing IDE uses Swing components (buttons, drop down menus, text boxes, etc).

There is a program called Scene Builder which lets you design interfaces for your programs using javaFX / openJFX:

Processing has a graphics mode that internally uses javaFX, and it’s triggered like this: size(400, 400, FX2D);. I haven’t really tried it, but it’s supposed to be very fast for 2D graphics. Using FX2D does not make it easy to use javaFX features like GUI components or visual effects though. Recently @lqdev showed at A way to add fancy effects to your sketches . In my answer about the Datepicker I showed how to tap into the Processing internals to get the stage element, which you would need to draw javaFX GUI components.

Would it make sense to give easy access to the javaFX features from Processing? Personally, I don’t know, since it is incompatible with P2D and P3D. Maybe it would be nice to open 2 windows, one with javaFX in which you can create a beautiful GUI, and another with P2D / P3D in which you render your graphics. I can imagine the preferred option is to leave javaFX entirely for more advanced users who can figure out how to combine it with Processing, or?

4 Likes