Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GUI creation in Scala but WITHOUT Swing/AWT

I'm going to write a new application which shall have a GUI. As I recently crossed a book about Scala (and became really choked-up) I decided to learn that language first and then try to build the program.

What I was wondering: Is there any decent way to build a GUI in Scala without being forced to make use of the Swing/AWT toolkits? I don't like Swing/AWT as they seem immature in comparison to Qt & Co. Unfortunately I could not find much information about building a GUI in Scala without depending on those.

As I am quite new to Scala and don't know too much about it, yet, I'm also wondering if the Java-binding of a specific toolkit could be used in Scala in a way that didn't sacrifice any of Scala's pleasant features (e.g. pattern matching).

One further note: The toolkit should support Linux and Windows and the Look-and-Feel should equal the native one on each platform.

UPDATE: This is my current ranking of toolkits (feel free to comment on this):
1. SWT
+ native L&F
+ a real Java solution
. not sure about performance, yet
. not sure about the easy of learning and coding, yet
- dealloc needed to free resources
2. Qt Jambi
+ partially native L&F
+ many possibilies
+ quite easy to learn
. not sure about performance, yet
- a wrapper around a C++ toolkit => might the code become ugly?
3. Java Gnome
. not sure about anything, yet - has anybody tried it?

Toolkits for which no actively developed Java wrapper seems to exist:
- WxWidgets

Toolkits which are discarded:
- Swing/AWT: Old and I don't like the coding
- JavaFX: Rich Internet Application targeted - I want a standalone application

A new toolkit written for Scala programmers from scratch would be nice but I guess this won't happen due to the possibility of reusing Java based solutions.

like image 417
Bastian Avatar asked May 22 '11 12:05

Bastian


1 Answers

Scala should be able to do anything you can do in java, so yes if you have a java binding for a gui library, it should work fine.

Have you looked at SWT, as an alternative to AWT/Swing? It uses native widgets whenever possible. Eclipse is written with SWT.

like image 195
James Scriven Avatar answered Sep 26 '22 19:09

James Scriven