Visual Layout (Scene Builder)


#1

I’ve discovered Kotlin in AndroidStudio 3 two weeks ago, and I like it (as I’m a lasy coder :wink:)
2 Android apps for test purposes were very easily to programm and work fine.

Now I have to take the decision wether I’ll stuck on Kotlin, or switch back to JavaFX 8 for my Win 10 programs.
To stay on Kotlin I MUST have a visual tool (for design, XML and CSS …) like SceneBuilder

I couldn’t find a tool like this for Kotlin, but unfortunatly I have to maintain several programs.
Is there a (free) tool like Scene Builder for Kotlin?

(So far I’m working with Eclipse. But I can change the IDE.
… but I’ll not work on two language systems on my everyday work.)


#2

@sirtom - Are you referring to Kotlin on Android only? Kotlin has a third party framework for JavaFX called TornadoFX, which has FXML support. Highly advisable when using TornadoFX to use its DSL instead of FXML to define views. There is even an option to hot reload views in TornadoFX (https://www.youtube.com/watch?v=HbPngSnvaWQ), which provides very nice but reasonably responsive visual feedback.


#3

You can use your javafx FXML applications as is in kotlin (without any additional libraries). But I also recommend tornadofx DSL instead, at least for simple constructs. For complicated things tornadofx fxml delegate works like charm.


#4

Are you referring to Kotlin on Android only?

No, for android I use AndroidStudio. It has everything I need.

For my Win10 Programs I’m looking for some visual tool.
I got aware of TornadoFX but didn’t find a neat tutorial, nor videos.
furthermore “hit reload” (whicht I’ve seen already) makes exact the opposit of my wishes:
* I have to CODE to see the result,

  • but I’ld like to stitch the result visualy to GET the XML- and CSS-files!

My goal is: 1 Language + Visual editors for all programming
Android: -> Kotlin in AndroidStudio
Windows: -> Kotlin + XXXXX ? (SceneBuilder doesnt work)


#5

The tornadofx team have put pretty good effort to build good documentation here. Particularly, here is the chapter about FXML and scene builder.
Also I can’t see the problem. SceneBuilder does work with plain kotlin even without tornadofx. There are no problems here.


#6

Thanks a lot. This will help me getting started.

I just dont have (at least not yet) any clue how to get Kotlin and SceneBuilder together.

Whereas learning curve for Kotlin was (so far) very shallow, now I seem to be blocked by a wall.
(How to start TornadoFX? How to combine with SceneBuilder? Do I need this “Mavin”? I have never handled a “Gradle”? Do I need IntelliJ, or may I keep Eclipse? …)

… but I’ll start reading. (I’ld kill for seeing a Video “Kotlin + Scenbuilder: The Tutorial”)

Thx for your help. Alone you claim: “SceneBuilder does work with plain kotlin” makes me hope to get the way.


#7

The one thing you have to understand is that neither Android GUI builder, neither Scene Builder create GUI elements. Both of these tools are just visual instruments to edit specific XML which later is translated to Java code by appropriate tools.
If you create a fxml file with Scene builder (which could be integrated for example into IDEA), You can use it not only from Kotlin, but also from Groovy or any other JVM language.

But from your comments it seems that you have a long way to go. The whole Android development is currently made by gradle build system. I can’t see any way you could have missed it.


#8

Thx for you encouraging.

I knew operation mode of SceneBuilder.
But now I regongniced, that my problem was: Confusing Android and Windows!
I was looking for XML/CSS-Elements in AndroidStudio. Obviosly that doesnt work. so SceneBuilder doesnt work there, but Kotlin/IDEA/Scenebuilder work fine together for Win-Programs!

PS: I have seen Gradle on my Android project, but there was no need to interfer. In AdroidStudio it simply works.
Sure I’ll have to learn much, and I’ll do!


#9

@sirtom - Don’t know about your technical background. Can you please provide some basic information on your background - eg What programming languages do you know/have experience in, have you used a build system, major technologies that you have used. I’m assuming that you haven’t touched a build.gradle build file before, which is very surprising considering that the official Android tutorial gets into editing build files early on, which with Gradle requires knowing/understanding the traditional Gradle DSL (NOT the official Gradle Kotlin DSL) and the Groovy language.

Presumably you can use TornadoFX without a build system however you will find it very difficult to do it yourself (eg have to juggle dependency management yourself, manually manage the software development environment). Very much recommended to learn how to use Gradle as a build system, however if you want a much easier option there is Kobalt. Kobalt has a getting started guide (is a tutorial). The creator of Kobalt by the way is a well known former Googler named Cédric Beust (created the highly regarded TestNG testing framework for the JVM).


#10

I’m coding since decades(!) My first programs were in Fortran66 and I remember the switch to Ansi Fortran77.
Since then I have not only learned, but even worked in lots of languages and db-systems. So you have a glimps of my history.

I’m quite familiar with Java since 5 years now. (At least I thought! :roll_eyes:), have made about 10 (real used) applications in Java so far. and all are working fine.
Nevertheless I’m not that firm to know all constructions really good. Or frankly, I think I dont know/use many of the sophisticated modern ones! (Vintage programing style? :thinking: )
As i dont really care if type declaration is before or after variable and complex constructs only can be learned using them: my learning style now is combining sniplets, and later on getting used to the backgrounds. And: I like Youtube!

Using a good IDE like AndroidStudio protects you from messing up with Gradle/Mavin/Groovy. …
That’s exactly the goal of Kotlin: Get rid of all these boiler plates! Not only within the language, but even in the whole buildingprozess!
So for my android apps so far there was no need to touch them, not even “manifest”. (I not even looked at them). That might be different, as soon as I have to manage rights, access, …

Thx for your hints and links. I’l watch them! There’s a lot to learn.