Java FX 2.0 SDK beta is out now

JavaFX 2.0 SDK beta is now available for all users, (you have to have a free oracle account)

http://javafx.com

Please make sure your java is fully update to 1.6u25 before installing javafx2 runtime.

The manual install javafx2.0 runtime is temporarily required to be manually installed to be able to run javafx2 beta applets and such. This is only a temporary measure until they are out of beta.

I have had a chance to play around with it a little so far and I am very happy with what I am seeing so far.
I know some people have mixed feelings about it in general but I am incredibly excited. I have huge hopes for what it will bring to the Java community.

I plan to make up a few small demo games and tutorials in the coming week(s).

Nice feature set, stable so far, but has two characteristics that make it feel very “Java-like”: Performance is choppy at best and there’s no sub-pixel antialiasing on text. I know it’s a bit early to judge but if these two issues don’t get fixed I don’t see this going anywhere.

yeh, really cool features, good video playback with java is long overdue. Be really nice if they actually get it right this time round.

Gonna wait and see how the final version turns out before attempting to develop anything with it.

On on the pages they mention that the text and rtf isn’t fully implemented and that they haven’t et finished their performance tuning or “quicklaunching” protocols yet

I’m going to give it a try out. See how many triangles the scene renderer can push. I have developed in (Java SE) tools for generating a 3D world based on cubes. Unfortunately texturepaint hasn’t made it into the beta, so I will have to find out whether I can 3D rotate regular images and rely upon a regular grid structure to get seamless tiling - bother.

EDIT: Anyone had any issues with getting the Netbeans 7.0 JavaFx modules to work. It all installed supposedly Ok, but then rebooting netbeans gave 100’s of broken module dependencies. I did have a custom install. Now retrying with a full install…

EDIT: Now it won’t migrate my old projects, which it did first time round. Thankfully Netbeans 6.9 still works. Uninstalling again, deleting user prefs directory. Going out. Will try again later when I’m less annoyed.

really nice first impression here http://weblogs.java.net/blog/opinali/archive/2011/05/28/javafx-20-beta-first-impressions

Can’t wait to try out the new Java Plugin3, seems like they’ve finally thrown out all the bloat.

Cheers for the link.

Separate threads for rendering and key events, yay!

Pity that the post didn’t go into details about the rendering back end prism and how it works.

[quote]Concurrent Rendering

The first thing you will notice in JavaFX 2 is that it does event handling and rendering in different threads. And you will notice that… drum roll… because it will likely break your code – either legacy code ported from JavaFX 1, or new code written with old habits in mind, from Swing or other single-threaded UI toolkits or game engines. It certainly broke my initial port of JavaFX Balls (see next section). The JavaFX 2 runtime manages two threads:

* The EDT (event dispatch thread), identified as the “JavaFX Application Thread”. That’s where all your app code runs by default, including animation events (Timeline action handlers) or any other events.
* The Renderer thread, identified as “QuantumRenderer”. That’s where your scene graph is transformed, composed, rasterized etc., until you get nice pixels in the screen.
* The Media thread, identified as “JFXMedia Player EventQueueThread”. This takes care of video and sound playback tasks, such as decoding and buffering.

This is a powerful architecture; multicore CPUs are now the rule even in high-end mobile devices, so if your app leaves at least one core free, you get rendering “for free”. JavaFX’s Prism toolkit is fully GPU-accelerated, but the concurrent renderer is still important, because JavaFX’s rendering is not only rasterization; it involves higher-level steps like CSS-driven layout, scene graph transformation, resource and state management, caching, etc. Compared to other GPU-accelerated platforms, JavaFX has the extra advantage of offloading this high-level rendering from the EDT, increasing multicore efficiency without any effort or risk. Not to mention “business” machines without appropriate support for full GPU acceleration; in this case JavaFX will do software rendering, and if the system has at least a dual-core CPU (or even a single-core but hyperthreaded clunker), the concurrent rendering will provide some advantage.

There are still APIs like Platform.runLater() and javafx.async; you don’t want to perform slow operations like I/O in the EDT to avoid unresponsiveness to user events. And you can also tap into the full power of JavaSE’s concurrency.
[/quote]

The new plugin is promising indeed, too bad it’s no good for existing applets; any non-FX code will cause the traditional AWT-based plugin to be used. Although it’s likely that part of the deployment improvements, e.g. embedded JNLPs, can benefit legacy apps. Also I’m very curious to evaluate the full deployment experience, from JRE installation to warm startups and security model; but this is not possible with the beta (e.g. no web installer) and I expect this to be one of the last components to be really finished, so we gotta wait for the FCSs of both JavaFX and JDK 7 (or the first post-JDK7 JDK6 update, that will probably contain a back-ported plugin3; even today, the beta can work with JRE 6 by overriding its plugin… on Firefox it took me some effort to get working, I had to completely remove the legacy plugin, but then my Firefox profile is always a mess, continuously updated with betas).

I hope to publish soon a second blog with initial benchmarking results; this may take a week or two, this first article was already a drag of my time. But first impressions are very good; the scenegraph and Prism can push a few thousands of animated nodes, this on a laptop with Intel HD graphics and without optimizations like multiple layers (groups) with caching. The major issue I see now for games (IMO; not a game dev) is that the scenegraph does not support (or does not expose public APIs for) low-level 3D geometry; and you definitely don’t want to convert a 100K-triangle model to 100K of scenegraph nodes which are too heavyweight for that. Also no public access to shading, yet; which always intrigued me because internally this is a bright part of the JavaFX runtime… maybe will be exposed to developers when more mature. So, right now, JavaFX 2.0 appears to be an excellent platform for 2D or “mostly 2D” games. Or, to be more precise: as the father of a 4 years old boy, in the last months I’ve looked at hundreds of Flash games available in the internet, and there isn’t a single one that FX2 wouldn’t do at least just as well. It’s a great start, and the 3D support will improve. Right now there’s no official announcement (or even leak) of specific plans post-v2.0, but I guess the Roadmap will be updated after 2.0 ships.

Not only that, but this paragraph of Cindy Castillo’s blog on the architecture seems very important:

[quote]The Glass toolkit is also responsible for managing the event queue. Unlike the Abstract Window Toolkit (AWT), which manages its own event queue, the Glass toolkit uses the native operating system’s event queue functionality to schedule thread usage. Also unlike AWT, the Glass toolkit runs on the same thread as the JavaFX application. In AWT, the native half of AWT runs on one thread and the Java level runs on another thread. This introduces a lot of issues, many of which are resolved in JavaFX by using the single JavaFX application thread approach.
[/quote]
Now on the rendering back-end… I don’t have this information, maybe somebody from the FX team can please us with the gory details :wink:

O_O

I was always very impressed with Swing, Java2D and applets for what they did. For a cross-platform UI it is really damn good. But that was mainly true 5 years ago, today it really shows it’s age. So I’m really happy about the new JavaFX. It’s a great reboot for the Java client rather then the endless dragging of inferior improvements that Sun was slowly churning away at.

[quote]The Glass toolkit is also responsible for managing the event queue. Unlike the Abstract Window Toolkit (AWT), which manages its own event queue, the Glass toolkit uses the native operating system’s event queue functionality to schedule thread usage.
[/quote]
Finally we’ll see endless amounts of ‘AppName (not responding)’ in the java landscape too :cranky:

Finally we’ll see endless amounts of ‘AppName (not responding)’ in the java landscape too :cranky:
[/quote]
…and guess what: it’s a bugfix! I just did this test: put a “while(true);” inside an event handler of a Swing app; run it, trigger the event, nothing happens. Windows 7 is not aware of the problem, doesn’t tell me that the application is broken even after I click the Window-Close control, because the native AWT layer is happily consuming the event queue - it’s just the Java EDT that’s not processing these events. Task Manager shows 100% of CPU usage (of one core), and it’s the only way to kill the process.

Now repeat the exercise in a JavaFX 2 program. Trigger the event, Windows immediately identifies the app as “(Not Responding)” in the title bar. Now click Window-Close, Windows fades the app window and raises the “Application is not responding…” popup, with the Close and Wait options. So I can close it or use Windows’s fancy “check for a solution…” diagnostics feature. No need to use the scary Task Manager (or if I was my mom, I would probably just hit the power button to reboot…).

And it gets better. Check the Event Viewer, and sure enough, only the JavaFX hang has created a pair of Windows Error Reporting and Application Hang events and dump files. This stuff may be useful for support; will be consumed by app monitoring systems often used in corporate networks.

…and guess what: it’s a bugfix! I just did this test: put a “while(true);” inside an event handler of a Swing app; run it, trigger the event, nothing happens. Windows 7 is not aware of the problem, doesn’t tell me that the application is broken even after I click the Window-Close control, because the native AWT layer is happily consuming the event queue - it’s just the Java EDT that’s not processing these events. Task Manager shows 100% of CPU usage (of one core), and it’s the only way to kill the process.

Now repeat the exercise in a JavaFX 2 program. Trigger the event, Windows immediately identifies the app as “(Not Responding)” in the title bar. Now click Window-Close, Windows fades the app window and raises the “Application is not responding…” popup, with the Close and Wait options. So I can close it or use Windows’s fancy “check for a solution…” diagnostics feature. No need to use the scary Task Manager (or if I was my mom, I would probably just hit the power button to reboot…).

And it gets better. Check the Event Viewer, and sure enough, only the JavaFX hang has created a pair of Windows Error Reporting and Application Hang events and dump files. This stuff may be useful for support; will be consumed by app monitoring systems often used in corporate networks.
[/quote]
Yeah I kinda do prefer JavaFX2’s way of doing it. A hung program whose death can only come about via the task manager is worse than a hung program that the native OS automatically terminates.

I’d also expect most users won’t realize the hung app is eating their CPU usage, wasting power and making their PC hotter then it needs to be.

I’d also prefer it if a cross-browser app looked and acted more like a Windows app on Windows.

I am cautiously optimistic :slight_smile:

Cas :slight_smile:

I am optimistically cautious.

Hahaha.

Downloaded, will play with it asap.

Notice that “games” are not one of the suggested uses!

I think they are only doing it in the beginning to help drive in the more commercial and application based consumers. People who make games know they can make a game out of anything, heck, you can even make a game in Excel or PowerPoint.

By adding “games” it may make some non programmer think its more of a gaming language then a rich client multimedia interface for business and applications.

my 2 cents