I went to JavaOne a few months ago. It was a pretty neat experience and I learnt a lot of cool things. One of the things Sun was touting was the JavaFX family of technologies. It allows you to create RIA (Rich Internet Applications) using JavaFX Script, a domain-specific language built on top of Java. The demos were pretty impressive and it looks like Sun's answer to Flash and Silverlight. I went to a few JavaFX sessions and I signed up for the preview SDK, which came out a few weeks ago. Since then, I've been playing around with the language to see what it can do. The language is pretty neat and being dynamic, has some pretty cool features like closures, list comprehension, lazy/incremental evaluation (through binding), and triggers. In addition, it uses a declarative model (although you can still use the traditional model) for describing a GUI. The API provides Swing components, but I believe the intent is to completely move away from that and use only JavaFX GUI components.
Using a language that is only in preview is pretty interesting. The API is unfinished and the language isn't completely mature, but this is to be expected. That being said, it still looks promising and seems to be a very capable and expressive language. Also, seeing as it is built on top of Java, you have access to all of Java's rich API in addition to the numerous third-party Java libraries and API's that are out there. I've been playing around with it for the last week or so and I was able to write a small calendar widget. It simply shows a month view for the current month, with the current date highlighted. I haven't had much experience with writing GUIs in Java, so it took me a while to figure it all out. I shamelessly stole the colour gradient background from one of the demos in the preview SDK. The only issue I have right now is the load-time of the widget. It seems to take a while when you load it first. I don't know if it has to do with the way I coded it or not. I'm pretty sure I'm not doing it the best way, but I expect to get better once I get more familiar with the language.
Here's a screenshot of the widget running on Firefox 3 on my Ubuntu laptop (the theme is a Leopard theme):
I have more details on the project page.
i haven’t gotten a chance to mess with JavaFX but how is the load time of the application? One thing I never liked about Java is how heavily the VM taxes your resources. Performance and usability is key when it comes to client-side applications…does it promise?
Sheehan,
The load time on the application is pretty high right now. To run a simple application you have to download a series of jars (mainly javafx jars). I assume this is because the whole language is still in preview (the language reference itself is still in draft). I would think that they will be ironing out these issues once the actual release comes out. Well, I’d go so far as saying that they will have to address the load-times if they want to compete with Flash or Silverlight.
It’s true that the VM uses a bunch of resources but I think with processor speed and memory being where they’re at today, it really isn’t much of an issue. A lot of people say Java is ten times slower than C. But then C is ten times slower than assembly. So far, I would say performance is probably on par with regular Java (javafx is compiled into Java bytecode), but the load-times aren’t all that great. In spite of all this, I would still say that JavaFX looks pretty promising.
Very simple and effective example.