Hacker News new | ask | show | jobs
by tomc1985 3326 days ago
Funny, I was messing around with Kotlin for the first time last night. So far, the language seems well-structured and I really like that one gets all of Java's ecosystem without actually having to write java. (Also, "override fun" just sounds hilarious. Bwaha!)

Throw in TornadoFX and Gluon Scene Builder (formerly of Oracle) and you're spinning up high-quality cross-platform GUIs faster than Atom, with a visual editor, and without having to touch Javascript!

I've been trying to find a suitable, high-quality cross-platform GUI kit for a while and this looks like it might challenge my current favorite (GTK)

5 comments

I call Kotlin Android's Swift.
Wow.. Swift is reading a lot like JS and TS.

(PS. I am new in both the languages and no Swift expertise)

Exactly!
Heaven forbid they just support Swift instead.
You'd need to rewrite Swift to run on the Android VM (a big undertaking) or fork the Android frameworks to work well with Swift. That's a much bigger undertaking than supporting a language which was created for the JVM and specifically made for interoperability with Java.
Unfortunately the JavaFX menu bar is just as broken as the one in Swing. In particular (I'm sure there's more),

1. it gets very confused about the focus when alt-tabbing between windows (as alt, on Windows, also toggles focus on the menubar),

2. there is no attempt to solve the problem of submenus disappearing when you attempt to move the pointer towards them, which is solved in Windows and Qt with a delay, and in Mac OS and GTK with ... the solution that is actually documented in the OpenJDK wiki but not implemented: https://wiki.openjdk.java.net/display/OpenJFX/Menu+User+Expe...

So JavaFX might be high-quality in some way I haven't noticed, but to me its immediately noticeable qualities were its general slowness and brokenness.

Is JavaFX also included in the "safe" parts of Java (i.e., in an Oracle-sanctioned GPL VM)? I know there are some open-source versions, but Oracle's trigger-happy lawsuit button on Java these days has made me nervous to poke.
OpenJFX is part of Oracle's OpenJDK project.
It even works on FreeBSD https://www.freshports.org/java/openjfx8-devel/ so yeah, truly cross-platform open source GUI :)
New to Kotlin + ecosystem... So can you build Android UI's with Scene Builder? I see notes about it working with Gluon Mobile which appears to be a cross platform mobile library.
Not really. Android has its own graphical stack.

You might be able to write an ndk app targeting android with you own stack of widget, but that's very different from an 'sdk' app.

Not concerned about Android at the time, I was looking for a desktop app toolkit.

Now that you mention it mobile support seems to be in flux: http://stackoverflow.com/questions/20860931/is-it-possible-t...

For Android, just use it's UI toolkit. It'll work better than trying to shoehorn a 3rd party thing in.
No, Android does not support JavaFX or Swing for that matter.
From what I've read the open-source bits of Gluon Mobile are available for free via JavaFXPorts

http://gluonhq.com/products/mobile/javafxports/get/ <-- android, iOS, ARM

However it seems to be a barebones solution as it lacks mobile-specific controls (they want you to buy Gluon Mobile for that)

The problem is its performance on the device and size overhead is horrible. Javafxpackager is just about the worse too.

Check out Codename One which is more like Swing but far more robust. The GUI builder isn't as refined as scene builder but the final product actually works everywhere and far more portable than anything else.

Codename one "Professional Edition" is $79 per month! Basic is $19 per month... As a kind of "indie" developer that is very expensive. Gluon Mobile is not much less expensive at $42 per month. Still, free edition looks better than Codename 1 free edition.

Wondering if Jetbrains will release Kotlin/Native for a set price or charge monthly like most companies are doing these days.

Had to try Gluon Mobile for work for some weeks, being a complete newb to JavaFX.

I build a simple Pacman game. Running on Android wasn't a problem even though the builds took an entire minute to complete.

Compiling and running on iPhone was a nightmare though: At the beginning of the project I was able to run it - some days later I had to tweak the RAM being allocated to the trans/com/whatever-piler - a week later and the weeks after I was unable to compile it at all, there just wasn't enough in my MacBook to throw at the thing.

And the subjective performance was relatively bad too. They tried to reimplement Material Design and it looks somewhat like it, but it performs pretty badly.

Even their own conference app demoing Gluon Mobile is terrible and that says a lot.

Codename One is open source and has a free edition without nag screen or any license restrictions. For that $19 you get more platforms and no need for a Mac etc.
But you have to use their BS cloud build service? Hell no.
Instead of having both a Mac and PC which is the only other alternative that's physically legal.

Notice that this is a compile time feature, you don't need to use it for production.

Why so negative?

I'm also against "cloud everything" but here they seem to provide an actually useful service.

Those are good points, thanks for the heads up