💾 Archived View for spikydinosaur.com › 2021 › 11 › 27-ui-programming-in-clojure.gmi captured on 2022-04-29 at 11:17:25. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-03-01)

-=-=-=-=-=-=-

UI programming in Clojure

One of my recent mini projects at work was to build an application that parsed a bunch of files let you dig around and interact with the results.

It's actually split into two projects (it could be one, I guess); a frontend written with ClojureScript using reagent to provide the UI and a backend in Clojure that provides a REST interface to all of the processing of the files.

While this works OK, I also need to be able to give it to other people (customers) to run themselves and this two-part approach is just too awkward. Really what i really want is a single self-contained executable jar and no unnecessary webservers in the middle of it.

The options are pretty sparse:

- Dive straight into Swing

- Use the Seesaw wrapper for Swing

- Use a JavaFX wrapper

I've done the Swing thing before many years ago, I don't really want to go there again. Seesaw seems well-regarded but no significant updates for 9 years put me off. It's not always a bad thing, it could be the sign of a mature library but ...

Historically I've always avoided JavaFX. Many years ago I worked at the same company (different office / country) as its creator, Chris Oliver when it was still called F3. I would write Swing back then, I don't remember JavaFX (or F3) being mature enough. While I don't actually do much UI work I've been aware that it has been part of Java for a long time, and it can do an awful lot more than I know about.

It seems there are a handful of Clojure wrappers for it these days; cljfx seems reasonable and actively maintained.

Within a short time I've bootstrapped myself enough to build a skeleton UI thanks to a mixture of reading blogs and looking through the examples provided by cljfx. So far so good. If I find myself doing a bit more of this I might have to invest in a good JavaFX textbook to get a better understanding of what it's about.