What is the best way to do GUIs in Clojure?
Is there an example of some functional Swing or SWT wrapper? Or some integration with JavaFX declarative GUI description which could be easily wrapped to s-expressions using some macrology?
Any tutorials?
I know that you are hinting for classical desktop solutions, but web fits quite well with clojure. I've written a complete audio application where everything is hooked up so that if you add music to the audio folder it is reflected in the web UI. Just saying that Desktop application isn't the only way :)
There's been talk on the mailing list about a few Cells (a la Kenny Tilton's Cells) implementations. It's a pretty neat way to do GUI programming.
I don't think there is an official one, but personally I would take advantage of the fact that I am using one of the most powerful language in the world and just imagine what the perfect gui code would look like:
Your idea would differ but this should hopefully the above gives you some idea.
From this page:
And, of course, it would be worth looking at the interoperability section of clojure's website.
So I didn't see Fn-Fx on this list, from Timothy Baldridge (halgiri). This is a Clojure library providing a functional abstraction over JavaFX.
It can be found on Github at https://github.com/halgari/fn-fx.
To use, make sure you are using a recent version of Java (1.8 90+) and add a dependency to the github repo by adding the following to your project.clj:
:plugins [[lein-git-deps "0.0.1-SNAPSHOT"]] :git-dependencies [["https://github.com/halgari/fn-fx.git"]]
I have tried it, and it works out of the box.
I would rather go for clojurefx, it is a bit premature, but it does work and saves you time.
I started my GUI with seesaw and then tried another component in clojurefx.
I have finished both, and I am convinced that I am going to refactor the seesaw one to clojurefx.
After all, JavaFX is the way to go forward.
It feels lighter than seesaw. Or at least, writing it..
Bindings work, listeners work, most of the component work, otherwise, just use one of the macros to create a constructor for that particular case and job done. Or, if you find it difficult, write some methods in Java and ask for help to improve clojurefx.
The guy who wrote clojurefx is busy at the moment, but you can fork the project and do some fixes.