ScalaFX actually looks cool:

stage = new Stage {
  title.value = "Hello Stage"
  width = 600
  height = 450
  scene = new Scene {
    fill = Color.LIGHTGREEN
    content = new Rectangle {
      x = 25
      y = 40
      width = 100
      height = 100
      fill <== when (hover) then Color.GREEN otherwise Color.RED
    }
  }
  visible = true
}

I like the constraints approach:

Here are some examples of what you can do with the ScalaFX bind API:
height <== rect1.height + rect2.height
width <== max(rect1.width, rect2.width, rect3.width)
color <== when (hover) then Color.GREEN otherwise Color.RED

Compare the amount of code in ScalaFx compared to Java:
/ ScalaFX Property Setting:
width <== scene.width
height <== scene.height

// Java Dynamic Property Binding
colors.widthProperty().bind(Bindings.selectDouble(primaryStage.sceneProperty(),
"width"))
colors.heightProperty().bind(Bindings.selectDouble(primaryStage.sceneProperty(),
"height"))

On Sun, Dec 18, 2011 at 4:10 PM, Raju Bitter
<[email protected]> wrote:
> Here's something for the Scala fans among you:
> http://javafx.steveonjava.com/javafx-2-0-and-scala-like-milk-and-cookies/
>
> And did  you know that Oracle announced to open source JavaFX?
> http://javafx.com/faq/#4
> http://openjdk.java.net/projects/openjfx/
>
> When is Microsoft going to open source (dump) Silverlight?
>
> On Sun, Dec 18, 2011 at 2:36 PM, Raju Bitter
> <[email protected]> wrote:
>> Yes, after the failed years of trying to establish JavaFX, they were
>> probably looking for a language more common in the RIA world.
>>
>> And the <children> tag is ugly. :-)
>>
>> On Sat, Dec 17, 2011 at 7:08 PM, Max Carlson <[email protected]> wrote:
>>> The <children/> tag sure is fugly...
>>>
>>> -Max
>>>
>>>
>>> On 12/17/11 9:04 AM, Raju Bitter wrote:
>>>>
>>>> That's a bit surprising. I actually like the JavaFX Script syntax,
>>>> looked very clean and compact.
>>>>
>>>> http://docs.oracle.com/javafx/2.0/api/javafx/fxml/doc-files/introduction_to_fxml.html
>>>>
>>>> <?language javascript?>
>>>>
>>>> <?import javafx.scene.control.*?>
>>>> <?import javafx.scene.layout.*?>
>>>>
>>>> <VBox xmlns:fx="http://javafx.com/fxml";>
>>>>     <fx:script>
>>>>     importClass(java.lang.System);
>>>>
>>>>     function handleButtonAction(event) {
>>>>        System.out.println('You clicked me!');
>>>>     }
>>>>     </fx:script>
>>>>
>>>>     <children>
>>>>         <Button text="Click Me!" onAction="handleButtonAction(event);"/>
>>>>     </children>
>>>> </VBox>
>>>>
>>>> JVM scripting language support
>>>> The<fx:script>  tag allows a caller to import scripting code into or
>>>> embed script within a FXML file. Any JVM scripting language can be
>>>> used, including JavaScript, Groovy, and Clojure, among others.
>>>>
>>>> But who'd want to build JavaFX based UIs now?
>>>
>>>

Reply via email to