Thursday, December 13, 2007
Despite all the effort Sun announced at the last Java One, applets still suck. They have for years, so why would it matter? Because JavaFX Script, Sun's latest whiz-bang technology still needs a container to run in. Embed one in a web page, and they still have all the disadvantages of an Applet.Recently, I've worked on a web project that took advantage of both Applets and Flash technology. The difference in user experience is clear. And despite a complete rewrite of the Java plugin in Java6 Update 10, Sun is still a day late and a dollar short.
First the good news: Sun's version detection scripts work fairly well. The rewrite of the plugin for Firefox was sorely needed and will make a dramatic difference. And although I haven't seen the results, I suspect the modular nature of the new JRE will make for a much lighter weight experience for users.
So what's still missing?
The Applet framework has not been altered in any way. An Applet is still heavy-weight. It still makes an OS call to draw its window. This means that applets (and by extension JavaFX scripts) embedded in your web site will not play nice with CSS Z-orders. You cannot open a CSS dialog or popup on the same page as your applet, as your applet will always be on top.
Although the new plugin will be available as part of Java 6 (beginning with Update 10), it will need to be manually enabled by the user from the control panel. I assume this is because Sun doesn't want to ship new features in an update, which seems reasonable. But because of this, it won't be safe to assume your users can view your applet in a reliable way until Java 7 is widely available. Of course the new plugin won't work in Firefox 2 anyway. It requires Firefox 3. Oh, and it doesn't support Safari. If you run Safari, your at the mercy of Apple. Lets hope none of those JavaFx libraries get compiled to Java 6, because Apple doesn't seem to have plans to support my Powerbook with Java 6... ever.
What about the current plugin? Using the existing plugin can cause unpredictable results. In Firefox, resizing the applet can cause your applet to re-initialize (not just fire events, or call start() again). I've also seen the plugin randomly ignore the page layout and get stuck in an odd place on the screen. Refreshing the page usually fixes the problem, but that isn't something I really want to tell my end user to do. And of course the current plugin has none of the performance improvements made to the new plugin.
With all the excitement over JavaFx lately, I thought it might be a good time to remind people that there isn't a JavaFx plugin. JavaFx in the browser will still suck for all the same reasons Applets do. I expect them to continue to suck, as I see no evidence from Sun that they plan to follow through and actually fix any of this.