• HamsterRage@lemmy.ca
    link
    fedilink
    arrow-up
    3
    ·
    1 year ago

    I don’t know Scala, but it’s easy to read the example code and understand what it does. A lot of it reminds me of how well JavaFX integrates with Kotlin.

    The configuration code reads very similar to how Kotlin uses apply{} to do the same things.

    What I wonder, though, is how much you actually need ScalaFX to do this? Does it fall into the same category as TornadoFX does with Kotlin?

    For instance, in the example code it uses some sort of extension of Application which looks like it makes the Stage setup more declarative. But, presumably you could use the standard start() routine and use the same kind of syntax to configure primaryStage. So how much value does the custom Application actually add?

  • u_tamtam@programming.dev
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    ScalaFX is so good at what it does (offering a declarative and concise way to build UIs with events handling and animations) that I would go as far as to recommend it in place of FXML, and beyond just Scala projects. It’s that good (IMO)

    • UFO@programming.devOP
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      I have not used any ScalaFX or JavaFX but the pitch is great for a Scala fan. I’m a bit put off by the requirement for a JDK (JRE?) or SDK that didn’t seem to be automatically available - at least on my NixOS. Probably a NixOS thing? Didn’t look into it much.

      [error] Loading library prism_es2 from resource failed: java.lang.UnsatisfiedLinkError: /home/coconnor/.openjfx/cache/20+19/amd64/libprism_es2.so: libXxf86vm.so.1: cannot open shared object file: No such file or directory
      

      The demos are slick so I’ll definitely figure out what’s going on. Once I have time haha

      • u_tamtam@programming.dev
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        I’m not familiar with NixOS, so I really can’t help with that missing dependency… regarding the requirements of a JRE, it looks like GraalVM+native-image lets you now compile to native and produce executables that do not require a JVM. Gluon is a company specializing in that, plus offering the tooling to compile JavaFX to iOS/Android too (I haven’t dabbed beyond simple hello worlds with their tech, though).