Where is XAML/WPF for Java?
WPF is the name for a bunch of libraries providing a way to create rich client applications. WPF includes XAML. I've been looking for a Java equivalent to what .NET offers with WPF. For those who are unfamiliar, the idea behind it is that you define your UI in a domain-specific language (DSL) to keep the UI separated from your actual code. This has a ton of benefits including speedier development and easier maintainability. This is not valid syntax but it may look like this:
// UI - XAML or some other DSL <ListBox binding="myListVariable"></ListBox> <Button content="Add Order"></Button>
// Code for the UI List<String> myListVariable = new ArrayList(); myListVariable.add("Printer"); myListVariable.add("Keyboard");
Essentially, the UI will keep the ListBox updated with the contents of the myListVariable variable. If you add something to the myListVariable later on, the UI will automatically update. That is the power of data-binding.
I finally found a good equivalent of WPF for Java called JavaFX. It's been around forever but has not had a good equivalent to XAML until relatively recently which is called FXML. My quick research tells me that FXML came out around 2011. However, it did not get bidirectional data binding until about April of 2012. An example pulled from http://docs.oracle.com/javafx/2/api/javafx/fxml/doc-files/introduction_to_fxml.html#expression_binding looks like this:
<TextField fx:id="textField"/> <Label text="${textField.text}"/>
I haven't actually prototyped anything with it yet, but am going to leverage this weekend for a project I have in my Software Engineering course.














