• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Scala for GUI?

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all!

I'm going to make a little desktop application which would run on JVM. I'm considering Scala as a language for it.
I know that Scala would work with swt or swing. I've also found some swing dedicated Scala libraries: ScalaGUI and scala-swing (this one is included in Scala API).
So, would you recommend to use Scala for GUI application?
If yes, what option is preferable:
- (pure java) swing
- swt
- ScalaGUI
- scala-swing
- a combination of multiple options above
?
Also, Groovy's power feature for swing is swing builder. Has Scala anything similar?


Thanks
 
Ranch Hand
Posts: 883
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From what I've heard about Scala, I got the impression that it's great for back-end work. Personally, I think you might find JavaFX, or something similar for a GUI.
Burk
 
Andriy Tsykholyas
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Burk,

thanks for you reply.
I've missed some details in my previous post which probably are important why JavaFX was not on the list
The details are:
- my primary platform is Linux;
- I'm familiar with Swing/Java and not familiar with Linux programming;
- I'm going to learn Scala (and maybe SWT)
- one of main reason why I've chosen Java is ease of deployment (you need only JRE and application jar file/files).
I think JavaFX has following drawbacks which are not the issue for Swing/SWT based Scala (of Java) solution:
- problems with Linux;
- immaturity;
- heavyweight (AFAIK JavaFX is build upon Swing with significant hierarchy of classes).
So, that's why I prefer not to choose JavaFX.

Andriy
 
Author
Posts: 135
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Andriy, the first thing you will find interesting and refreshing is how Scala idioms intermixes well for
event handling. The way you register for handlers (for buttons, etc.) is quite different and nice. Second,
Scala also allows you to let the GUI code handle in the main thread while rest of your applications can
deal with tasks in other threads. The last thing I can think of that may be of interest to you is
the conciseness of GUI code. I agree that I would not consider GUI development as the significant strength
of Scala, however, if you are using Scala and want to use it for GUI development, then the answer is most certainly
a yes; you can and you have some benefits like I mentioned above.
 
Andriy Tsykholyas
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Venkat,

thanks for your answers. I think the advantages of Scala pointed out by you should be quite helpful. So, I'm going to try it

Andriy
 
Burk Hufnagel
Ranch Hand
Posts: 883
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Andriy Tsykholyas wrote:The details are:
- my primary platform is Linux;
- I'm familiar with Swing/Java and not familiar with Linux programming;
- I'm going to learn Scala (and maybe SWT)
- one of main reason why I've chosen Java is ease of deployment (you need only JRE and application jar file/files).
I think JavaFX has following drawbacks which are not the issue for Swing/SWT based Scala (of Java) solution:
- problems with Linux;
- immaturity;
- heavyweight (AFAIK JavaFX is build upon Swing with significant hierarchy of classes).
So, that's why I prefer not to choose JavaFX.

Andriy


Andriy,
No problem, but you've got some misconceptions. Things have changed since the early days.
1) JafaFX is available for Linux. Go here - http://javafx.com/downloads/linux.jsp to download it.
2) JavaFX runs on the JVM and builds on what you know about Java and (to a lesser degree) Swing.
3) The JavaFX runtime is part of the JRE since Java 6 update 10 so you've probably already got what you need to run it.
4) It deploys just like a Java app.
5) Does not build on the Swing components - though you can wrap Swing components with JavaFX code is you need or want to.

There's been a lot of changes since the beginning of the year and it's probably worth taking another look at. That said, if you want to do a pure Scala app then that's your choice. I just wanted to make sure you knew that a number of the things you listed were not true or were no longer true.

Burk
 
best scout
Posts: 1294
Scala IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

It seems like Scala could be used very nicely for lots of different things besides its well-known use cases. From what I know Scala currently only provides some kind of core library, right? Do you think other libraries or frameworks (for example for GUIs, enterprise apps etc.) will start to grow soon in the near future? I know you can any time mix it with Java but it sounds like you could make lots of improvements and have advantages with "native" Scala libraries. How do you see Scala's place regarding other areas in software devlopment besides its core functionality? Maybe I just don't have enough experience here because Lift is the only popular Scala framework I know at the moment But I'd be glad to see Scala gaining more popularity in other fields.

Marco
 
Andriy Tsykholyas
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Burk,

thanks for your explanations. It looks like I need to take a closer look at JavaFX
The combination of back-end written in Scala and front-end in JavaFX may be quite interesting. The drawback is that accessing advanced Scala features from Java (and probably from JavaFX) is not too easy.

Andriy
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a look also here: http://code.google.com/p/scalafx/
 
Ranch Hand
Posts: 56
Scala Mac OS X Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Grigory Kislin wrote:Have a look also here: http://code.google.com/p/scalafx/



As for the moment, scalaFx is in my opinion still immature for serious enterprise development, it really need more consistency, more polishing and support for all the components.
At the same time you can gain a lot from it for small projects, and the dev team is working really hard right in this moment, so I expect many improvements in the near future.

For the time being I would stick to plain JavaFx, which can gain a lot from scala syntax and features, for example, as already said, in event handling, but not only that.

I would also take a glimpse at the visage project [1], if you like scalaFx syntax. It's a JVM language targeted to UI development that takes up from the first JavaFx releases, so it's compatible to Java, and Scala.

[1] http://code.google.com/p/visage/
 
Your mind is under my control .... your will is now mine .... read this tiny ad
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic