Is it possible to use them in conjunction? It would be nice to write the GUI in JavaFX and define the business logic in Scala. Any ideas?
+5
A:
Scala and JavaFX both run on the JVM, so there should be few problems integrating the two.
Pain points may involve converting between Scala and Java standard collections since the implementations are different (e.g. a Scala list is not a Java List) but that aside, there shouldn't be major issues.
Brian Agnew
2010-03-02 20:07:47
+3
A:
If it's just a more script-like UI definition code that you want, I'd urge you to look at Scala-Swing as it lets you write code like:
Scala Swing
val f = new Frame {
title = "My Scala Swing Frame"
width = 300
height = 300
content = new BoxPanel
content += new TextArea {
font = new Font("tahoma", 22, Font.PLAIN)
textAlignment = Center
text = "Welcome to\nScala Swing"
}
}
Compare that to this JavaFX example
Java FX
Stage {
title: "My First JavaFX Sphere"
scene: Scene {
width: 300
height: 300
content: [
Text {
font: Font { size: 22 }
x: 20, y: 90
textAlignment: TextAlignment.CENTER
content:"Welcome to \nJavaFX World"
}
]
}
}
Of course, there may be other features of JavaFX beyond this code-style which you are looking for.
oxbow_lakes
2010-03-03 11:17:11
Cool, didn't know something like that existed. Does it also support features like binding?
Helper Method
2010-03-03 18:06:56