Best way to program a gui

I know how to program java-swing applications.
But what with scala. Do I use swing, can I use swing together with scala or do I use a higher-level API ?

It may or may not make sense for your needs, but many Scala programmers build their GUIs in the browser – since Scala compiles to JavaScript, you can use browser-native frameworks like React, or Scala-centric ones like Laminar, to build your user interfaces that way.

1 Like

Is there something like kemal (crystal language),

I used to write a fair amount of Swing code in Scala directly, and that worked fine. But you might also want to check out GitHub - scala/scala-swing: Scala wrappers for Java's Swing API for desktop GUIs

1 Like

Another option:

JavaFX

or

ScalaFX

Setup is more difficult but you have a WYSIWYG GUI builder based on XML.

Use of Swing has no additional setup required.

HTHs

1 Like

If you know Swing well then perhaps the shortest path is to write a few of your own simple wrappers around the stuff in Swing you use the most to both take advantage of the Scala abstractions mechanism you find most useful and your Java Swing knowledge.

Here is an example of how “thin wrappers” can be used in a graphics library for teaching beginner programming that connects directly with Swing with no other dependency:

“Thin wrapper” example:

1 Like