Maurizioi Storani wrote an excellent blog post about his first impressions using JavaFX's new GUI API (javafx.gui) titled "JavaFX (James Weaver)". That post shows a simple example of JavaFX code using the new javafx.gui library. Out of curiosity I asked Doug McCrae, a Curl engineer, to write up the same exact program in Curl. It turns out that Curl code looks a bit shorter than the JavaFX code. Anyway I thought it would be fun to see if other bloggers would be willing to post the code for their favorite RIA technology. It's a pretty short program and very GUI centric, but its a fun to compare solutions all the same.
If you have never used Curl before you'll find that running the Curl application is easy. Copy and past code below into a text file and save it as "helloGoodbye.dcurl" to your desktop. Then download and install the Curl RTE. Once the RTE is installed, run the Curl application by simply double clicking on it. It will look almost exactly the same as the JavaFX code that Maurizioi created.
{curl 6.0, 7.0 applet}
{value
def content = {Frame}
{View title = "Hello, Goodbye",
width = 400px, height = 300px,
visibility = "normal",
background = "#DDF",
{on WindowClose do
{exit}
},
{VBox
margin = 6px, font-size = 36px,
halign = "center",
width = {make-elastic},
{vcenter content},
{HBox spacing = 6px,
{CommandButton label = "Hello",
{on Action do
{content.add "You say hello...", replace? = true}
}
},
{CommandButton label = "Goodbye",
{on Action do
{content.add "and I say goodbye", replace? = true}
}
}
}
}
}
}
I don't recommend running the code I posted on Maurizioi blog because the commenting feature removed all the white space so it doesn't work. Also the one attached is even shorter than the one posted to Maurizioi's blog.
Note: Code has been modified since original post to take out errors introduced by formatting and also to make the code more readable.