Cljfx: declarative, functional and extensible wrapper for JavaFX inspired by better parts of react and re-frame

clojure

#1

I’ve made a cljfx after I moved from web development to desktop applications. I was surprised there are no libraries like react/re-frame for JVM, so I’ve made one.


#2

This looks really nice. I like how you have simple and advanced full examples!

Will definitly be trying it out.


#3

Cool! You just got me tangibly more interested in touching desktop GUIs. Random things I really liked at a glance:

  • Fine readme that explains the project well
  • Plenty of examples (as @didibus noted)
  • Data-driven API!

Care to comment on API maturity? Does 1.0.0 mean you intend to keep the examples you’ve got working as-is moving forward?

Teodor


#4

Thank you and @didibus for kind words!

Regarding API, I see a lot of value in Cognitect’s approach of growing software by accretion, relaxation and fixation, so I’m following it. Probably should state it in readme too.

I feel your sentiment about touching desktop GUIs. Web interfaces had so much progress it’s sometimes easier to just use browser for desktop application, and trying something more native feels cumbersome. That was one of the reasons why I made cljfx.


#5

Very interesting! I have been using seesaw for my Clojure desktop GUIs, and it definitely makes Swing nicer to deal with (and I say that as a co-author of O’Reilly’s book on Swing) but it has quirks and isn’t actively supported any more. Even though I have been able to build fairly extensive interfaces using it, this looks like it might be nicer. I’d have to bite the bullet and learn JavaFX, but it does look like you offer the kind of hooks I need to be able to drop down to doing my own raw drawing when required. I will have to keep this in mind.


#6

Yeah, I tried seesaw, but didn’t like its mutating api, also it didn’t have hidpi support for linux, and it happened that I have hidpi linux laptop as a main workstation, so that sealed it.

JavaFX has it’s quirks too, unfortunately. For example markdown editor, which has cljfx’s readme as a default, can’t handle that much text in one text area, so text is just cut at some point, while it’s still displayed fully in preview.


#7

https://github.com/fn-fx/fn-fx may be similar?

I’m surprised there’s not more Reactish libraries in java or native for ui development too.

Thanks for fighting the good fight!


#8

Yeah it is similar, it’s mentioned in readme, also we had a bit of discussion with @Timothy_Baldridge (author of fn-fx) about cljfx in this reddit thread if you are interested.


#9

Would there be any limitations as opposed to directly using JavaFx?

Its okay if cljfx doesn’t do everything, I’m asking more what happens when it doesn’t? Is it easy to do the missing parts in normal JavaFx and have both things integrated nicely?


#10

It’s not easy, and now that I’m started to think about it, I think adding some kind of on-created/on-advanced/on-deleted callbacks might be very useful. Probably will add it sooner rather than later.


#11

I mean, it’s possible to add these callbacks without changing the library by creating a custom lifecycle, but such callbacks might be so useful they really should be a part of cljfx.


#12

I released version 1.1.0 that introduces straightforward way to fill missing parts.


#13

Hey that’s awesome! Now even more reason for me to try it out!


#14

I released another version of cljfx, now with a way to decouple component lifecycle from scene graph.