Charles has posted 4 posts at DZone. View Full User Profile

What's Wrong With JavaFX and What Needs Fixing?

07.29.2009
| 9710 views |
  • submit to reddit
With the recent spate of Rich Internet Application frameworks - such as Flex, Silverlight and more recently JavaFX (script) - it is clear that there is a lot of confusion over using a Java-based RIA framework such as JavaFX or using a Rich Internet Platform based on Java such as the Eclipse RCP or NetBeans Platform.  Of course - there shouldn't be any confusion except that Sun seems to have created the confusion by leaving doors open to dark rooms. First, JavaFX is hardly a replacement for something like the NetBeans Platform or Eclipse RCP - its target, in my opinion, only fills a small but important segment: small rich media internet applications.

As a point of reference, there are tons of Swing-based apps, some that qualify as being excellent rich multi-media apps. I've been looking for some nice examples and found some that really impressed me.  A few examples that I found on the NetBeans Platform site (the descriptions are included as well):
- BlueMarine - is an open-source application for digital photo workflow.  The blueMarine project provides you with an all-in-one tool for managing your photos, from the shoot up to archiving and beyond.
- MassTk - is an engineering analysis application by Boeing. It incorporates the functionality from several legacy mass properties analysis applications that were originally written in Java, Fortran, C, and even Perl.  It provides a rich GUI with custom editors for all business objects including 2D & 3D visualization.  In addition to this application there is the Boeing Shared Platform is a logical outgrowth of building MassTk on top of the NetBeans Platform: BSP is a feature-rich platform created by factoring out the modules from MassTk that are not specific to mass properties analysis, but are useful to engineering analysis applications in general.
- ThinkingRock is a free, platform-independent Java application for collecting and processing your thoughts. This simple and easy-to-use tool follows the Getting Things Done (GTD) methodology
- Domito Manager, by MCD Electronics in Poland, configures a system that controls lighting, heating, and opening/closing of gates in houses. In the building sector, a system of this kind is known as an "intelligent home".
- The Sepix Sales System is a customer relationship management system for sales managers on the road. At this stage, the application is running on the NetBeans Platform with a fully functional module for mapping and routing. The application offers a map display, works as a route planner, and is capable of displaying data from a database as geolocations. You can display any type of graphical layer over the map, with sales territories or any kind of POIs, such as speed limit zones.
- Nokia offers a complete solution for managing mobile networks and end-user services, called Nokia NetAct™, ranging from control-room software for 24/7/365 monitoring of the network to software for graphical optimization.
- Puzzle is a Java Geographic Information Systems (GIS) development platform.  The main goal of Puzzle GIS is to create a free, production ready and competitive tool as a valid alternative to commercial software.
- Agile Client is a NetBeans Platform application developed by Northrop Grumman in partnership with the Defense Information System Agency (DISA). It brings the war fighter a 3-D common operational picture (COP) workstation designed for greater efficiency and mission effectiveness.

All of these applications seem to have three things in common:

  1. They are built using the NetBeans Platform.
  2. They are data-intensive applications that in most cases are of a mission critical nature.
  3. People use them to do real work and an intense number of data aspects need to to be visible (textually or graphically or both).

The NetBeans Platform constitutes a framework for getting difficult things done relatively quickly - not simply from the standpoint that it provides a wealth of resources and allows the architecting of large modular software but it also allows integration with other frameworks.

Slightly different Swing-based demos such as Aerith (code is here)  provide excellent demonstrations of what one can do with Swing graphically. They leverage not only Swing but also - Java2D, OpenGL, Timing Framework (for animations), SwingX, Matisse, Google Maps, Flickr, Yahoo! and more.  This is an example of the beauty of a nice open non-proprietary set of frameworks all playing together with open interfaces to web services.   Note among these frameworks are a number of residents at SwingLabs

So let's add Aerith  to our  list- since the code is out there and it offers an example along with some very flashy functionality.  A few more:

- Aerith is a Swing Mashup, or smashup, combining three webservices: Google Maps, Flickr, and Yahoo's geocoding webservice to let users create, view, and share slideshows of their road trip photos. It was presented as a demo at the 2006 JavaOne conference by Richard Bair, Romain Guy, and Joshua Marinacci.
- Vuze (formerly Azureus) which is a is a BitTorrent client written in Java - I would be remiss in not including Vuze in the list of excellent Java-based applications - even thought it doesn't use Swing but rather SWT.  It is an excellent example of a Java GUI.  
- In the Games area - Runescape and Tribal Trouble are two examples of how Java can provide a rich game experience

I will continue to create "the list" with the idea that (a) it might give a developer a perspective on what people are doing (b) how they are constructing their apps.  I also encourage developers to look at the extreme Swing series from past JavaOne conferences.  

Meanwhile, I do see the beginnings of JavaFX apps beginning to emerge such as musicpin from GUI thought-leader, Canoo,  and Indaba's Collaborative Digital Audio Workstation.  A JavaFX development tool, JavaFX Builder, is also available and is very interesting.  However, surprisingly, that seems to be it except for the recently concluded JavaFX contest.  If you know of others I would love to know about them.

It is entirely possible that the arrival of JavaFX has confused some developers and this confusion may have even caused problems for Java on the client-side.  Why has this happened?  I have to remind myself where JavaFX is aimed at going - Sun has announced JavaFX is aimed at the - [a] desktop [b] mobile and [c] interactive devices including television.   Perhaps the tag line about JavaFX being for "all the screens of our life" has served to confuse things even more.  For the same reason that an aerospace company would choose the Swing/NetBeans Platform over Flex or Flash - I also would make the same choice and probably for the same reasons. To these same developers and companies, they will look at JavaFX as being in the same RIA boat (and it is) and they look at it as containing less architectural flexability than a Swing RCP (modules/plugins, resources, RCP structure, etc).  The vagueness and marketing tag lines have served to confuse a fair amount of people and I am not the only one that thinks that

If you have followed my blog, you will know I have been very supportive of JavaFX (you can see from my past JavaFX blogs ) - JavaFX has its place - but that space is a lot smaller than the JavaFX marketing suggests.  Over time issues have emerged  that really need fixing and after some discussions with other Swing developers at JavaOne and post-JavaOne it looks like I'm not the only one with these feelings.  What's wrong with the JavaFX?

- Lack of a module system such as those found in Eclipse and NetBeans. The biggest thing people gain from the NetBeans and Eclipse Platforms is being able to break their application into parts, called modules.   As a result of not having a module system JavaFX apps are relegated to remain small, which in some cases such as small rich internet applications, is fine.  Wouldn't it be nice if JavaFX could integrate into Swing to be leveraged by existing module systems such as the NetBeans and Eclipse Platforms?  
- Lack of Two-Way Integration with Swing.  This is huge.  The one way integration that exists is unacceptable and apparently artificial. Integration of JavaFX into existing Swing application's isn't supported and that's where it could turn out to be most useful.  This is a huge oversight and hurts the use of the fledgling language's adoption.  More important - it's easier to build your larger apps using an RCP - which would allow two way integration of Swing/JavaFX and leverage the modular architecture of the RCP. 
- Lack of Controls.  There simply are not enough controls - the description I read in a blog the other day mentions the absence of the Tree and Table controls.  Ouch!  Keep in mind that Swing has a multitude of controls.  Controls like SwingX controls offer a number of additional controls which even offer themselves up to be used as components in NetBeans GUI Builder.  The hype that is surrounding the JavaFX 1.2 controls available is also disconcerting - "JavaFX 1.2 has real UI controls, designed for the 21st century".  If you look at the controls on the page - you shouldn't feel dumb - the majority look like Swing controls and the statement misses the fact that there are a huge number  of Swing and Java-based controls available- including smart charts, smart report components and many more useful "21st" century controls.
- Visual Development Tools. One gaping and large hole is lack of visual development tools.  The exception to JavaFX tools is NetBeans - at least with NetBeans you can write JavaFX code. However in this space you need a visual graphical builder and there is no graphical development builder, yet.
- Proprietary Framework. If the intention is to make JavaFX a viable alternative to Swing then JavaFX needs to be totally (not partially) open sourced just like Swing, Java,  NetBeans Platform, Eclipse, etc.  By not open-sourcing JavaFX it retains no advantage  over other competing RIA platforms and we should not be confused about the difference between OpenJDK (which has been open-sourced) and JavaFX. It also becomes less likely that JavaFX becomes an open source alternative to Swing and Swing-based frameworks if it is not completely open-sourced.
- Lack of Transparancy into JavaFX Roadmap.  In keeping with the non-open source nature of JavaFX - there is almost no visibility into what is going on - if I look at NetBeans or Eclipse or OpenJDK - I know where those projects are going.  For example, NetBeans has visibility into what they are building for the next release on a page that describes the features being worked on.  I have no clue what new controls will emerge in the next release of JavaFX - let alone other developments.  What constitutes the next release? 

JavaFX does not currently satisfy all the screens of my life despite the marketing tagline.  Some will erroneously view this as an attack on JavaFX - it is not.  This is simply part of the community discussion that has already started and is aimed to make JavaFX better - the starting place needs to be integrating JavaFX and Swing in a meaningful  two-way street (the answer to "it's hard" - is "most good things are"), provide better transparency into its roadmap, and making it open source. At JavaOne I was asked for my opinion on using JavaFX in real apps - I answered (after going through some of the issues above) that it depends on the type of app and it depends on your comfort zone with the above issues.

From What's Wrong With JavaFX and What Needs Fixing?

Published at DZone with permission of its author, Charles Ditzel.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Wai Ho replied on Wed, 2009/07/29 - 7:15am

Hear, hear!

Rael G.C. replied on Wed, 2009/07/29 - 8:38am

I work with web-development for years, and NOBODY with years of web development are paying attention for JavaFX, as they didn't paid attention for Flash/Flex/Silverlight.

This "rich web applications" for web actually consists only from: webgames, banners like "hit the monkey", Youtube videos (and Google + Mozilla are making a huge effort for HTML 5 runs video directly), and website menus for people don't know HTML/CSS/Js.

The "rich web applications" boom was in 2000, when Flash arrived and we saw a lot of entirely website did using Flash. But people realized that build web systems must not be confined to a proprietary plugin, and (thanks God!) entirely Flash websites are gone. And look: Flash has the most user-friendy IDE.

I see only new people in web development and Sun lovers talking about JavaFX passion. Things like "web don't have support for drag n' drop" or "web don't have support for mouse menu context". Did you really used GMail? Ajax, drag n' drop, all in a simple (not simplory) interface! And Flash don't have support for right mouse button menus (only play, stop, bw, fw, controls).

If Microsoft and all its infinite money supply just convinced some few site to use Silverlight as video plugin for copyrighted content (and some of them already back to Flash), what is the appealing of JavaFX?

Guido Amabili replied on Wed, 2009/07/29 - 8:56am

Hi,

I think it's only a matter of time but javafx will become the most popular platform of RIA development out of the three bigs (JavaFX/Flex/Silverlight).

JavaFX is designed to augment the user experience on the web, not to redefine the web standards...

JavaFX goal is not to kill/replace HTML5.

Charles, you already mentioned the indaba music console (http://www.indabamusic.com).

I suggest people bashing JavaFX should take a look at this application and check why the development team switched from flash to javafx...

Guido

 

 

 

 

Jakob Jenkov replied on Wed, 2009/07/29 - 8:58am

I have done web apps for a long time, and I am now using Flex more and more. But mostly I do so for more "application" style web apps. Not so much for more "text like" web apps.

 I like how Flex cleans up my backend as well as the front end. Well, I could probably get most of what I get from Flex via AJAX - true. But I like the fact that Flex extends easily to games in addition to web app GUI's. I would have to think harder about implementing a game in JavaScript, than in Flex. Note: I said "I", meaning I know JavaScript would be easier for others.

Anyways, I didn't mean to make any judgments at all. I am only saying, that I have done web apps for a long time, and I actually like Flex. Perhaps I'll like JavaFX and Silverlight too.

Jess Holle replied on Wed, 2009/07/29 - 9:38am

Along the lines of "lack of controls" is the lack of a good layout manager for complex UI forms.

As for "Visual Development Tools" a designer-oriented tool is in the works, but I'm concerned by the possibility that this tool may end up being too designer-oriented.  There's this focus on using high-end Adobe tools to design your UI.  Corporate intranet developers don't have access to or know how to use these -- they just want good control layout (ala Matisse).  If the "designer" tool does not provide good control layout without all the fancy "asset management" approach, then the result is a non-starter for corporate intranet applications -- and a whole lot of business applications in general actually.

Toni Epple replied on Wed, 2009/07/29 - 10:00am

I absolutely agree with everything you say about the problem zones of JavaFX.

My personal opinion is that the lack of integration with Swing is the biggest issue. I'm quite sure that the JavaFX team has been asked thousands of times since JavaFX was released "why can't I embedd it in Swing?". It may be difficult, but it needs to be done. And it needs to be done now, not in an unforeseeable future.

The message sent out to the Swing developers by the lack of two-way integration and by the fact that most Swing developers were moved to JavaFX is that Swing is going to be deprecated with no replacement. Maybe the intention is to make everyone move to JavaFX immediately. But with the lack of controls and even worse the lack of a module system that's obviously not a choice even for medium sized apps.

Embedding on the other hand would allow Swing developers to keep OSGi or the NetBeans Module System for managing the complexity and dynamics of applications and use JavaFX for the UI (which I think is it's domain). We could start by using it for visualizations and then slowly move the whole UI to JavaFX as more controls become available. This is where JavaFX would really have an edge over all it's competitors.

Just one example: One of the applications missing in your list is NDSatCom's application Network Management Systems  (Winners of the Duke's Choice Award 2009). I know those guys would love to add some cool JavaFX visuals, but will they port an application with Millions of lines of code and more than a thousand modules to JavaFX and loose modularity for doing that? And there are tons of applications and thousands of developers who would, like them, love to use it but simply can't.

When it comes to Swing developers JavaFX so far has been a PR disaster. Still I think it's not too late. I hope that your article will start a discussion and helps move things in the right direction. Really, my heart is bleeding when I see this cool technology heading in the wrong direction.

 Toni

Thierry Milard replied on Wed, 2009/07/29 - 11:13am

I also agree. javaFx looks really good from a visual perspective.

If you take a look at the Swing examples in the article, they look so 90's. 

They look so Swingish, so 90's. So yes there is (there was) a BIG opportunity for javaFx API/langage to be used by us Swing developers : Because we just kwow our Swing application look so "kind of old and static".

But as someone said it seems I just can not have 10 javaFx superbe animations/and/buttons/... and integrate SIMPLY those into java-Swing program.This is not yet possible I think. This is bad : I stopped my javaFx learning because of that 4 month ago.

 

So yes I think for me javaFx could be necessary but before 2 things must be made :

1) Integration of javaFx components into java-Swing code easy.

2) [of course...] the start of the javaVM has to take  2 seconds maximum, even if we have 6 other jars in the jnlp file.

 

Anyway I am positive because I think 94% of java and javaFx improvements have been done in the last 2 years. People don't see it but I bet if sun-Oracle comes back in a few month with a javaFx + java-better-startup-improvment  javaFx+java  will be a nice competitor to Flash. Let's us not forget there are so many java visual API that just rocks (jai, java3D, ...). In combination with javaFx,this would be great.

 

 

Wai Ho replied on Wed, 2009/07/29 - 11:41am in response to: Thierry Milard

tmilard replied on Wed, 2009/07/29 - 12:13pm

 

I also agree. javaFx looks really good from a visual perspective.

If you take a look at the Swing examples in the article, they look so 90's. 

They look so Swingish, so 90's. So yes there is (there was) a BIG opportunity for javaFx API/langage to be used by us Swing developers : Because we just kwow our Swing application look so "kind of old and static".

But do you really think that makes a different if you're a geophysicist or a bank employee? Or a satillite management administrator? JavaFX is not really very important to those kinds of industrial size applications... No one woking as a user with those applications CARES if somehing "look so 90's". They CARE if it is flexible, scalabale, and if it is easy to update...

Maybe the programmers of those applications CARE (because JavaFX is simpler to code than Swing), but the customer doesn't care very much at all!

Thierry Milard replied on Wed, 2009/07/29 - 12:26pm in response to: Wai Ho

Welll .... you just look back at the gui history. 

- In the 80 all application were caractere mode (with black background). Right ?

- Most of them did not need the windows look and feel .... but they switch to it althaw most of their clients did not really see an interest in changing.

- Today it is the same : all the internet sites have moved or are moving to a nice look and feel. The kind of really nice look and feel that make Swing L&F look so 90's.

- And yes I bet they will all go for a nice look with animation if they can.

the trend is to have :

+ PC application, +internet sites, +mobil application

==> with a nice look plus some animationsfor transitions.

 

If Sun doesn't succeed in this transition they won't have any business at all soon. and this has started allready : I can not find anywork in europe in Swing ! Bacause no one wants to have this poor Swignish look and feel.

 

Walter Bogaardt replied on Wed, 2009/07/29 - 12:29pm

JavaFX is still new, and featureless. If you look at Flex, there are so many componenets created for it out of the box it becomes childs play to make a rich app. Flex, JavaFx, and Silverlight still need to get on embded devices ubitiquously. Java has somewhat a foot in the door as the KVM is in most phones.

Flex also has remoteing with backend services and not just webservices, which JavaFx is limited there.

 

The question is JavaFx promising? Sure, but it has a lot to catch up with against Flex, which has been around longer, has better IDEs. 

 

Geertjan Wielenga replied on Wed, 2009/07/29 - 12:39pm in response to: Thierry Milard

None of the above is true for extermely big applications. For example, do you really think the geological and scientific applications referred to in this article are wanted as mobile applications???

Read: "a system architecture shouldn't be driven by the hypes of the IT business. It should be the result of an analysis of the scenarios the application has to support." Here:

http://netbeans.dzone.com/news/project-management-netbeans

And that's 1 app that is Swing based that could use some outsider assistance and there are many more, referred to in this article that youre responding to.

John Denver replied on Wed, 2009/07/29 - 12:52pm in response to: Walter Bogaardt

Always I bash JavaFX but I have trying it and people say Flex have good IDE's, I just know one and cost money FlexBuilder. With JavaFX, already there is a plugins for Eclipse and the support in Netbeans is getting good so about IDE's JavaFX is catching up pretty fast and maybe it could get more better with little more time than Flex does.

Also the API in Flex is a mess with the naming, I think they will try to fix this in Flex 4 and the namespaces but the API still a mess. JavaFX is very nice and how the API is organized also is more compact, JavaFX code is more beautiful.

The JRE plugin is getting smaller than Silverlight as I learn from one guy told me that in Windows Silverlight is already some components preintalled in windows but if we compare the two in a Mac, JRE is more smaller, Flash still more compact but I think JRE will get there also the speed and the graphics of JavaFX compared with other tools its getting there and maybe it will get better if Oracle does the correct.

I use Flex and I bash JavaFX but sometimes I think that maybe JavaFX have a great future and as someone said here JavaFX already have a foot in the embeeded so that is great.

Also JavaFX could be great for Thick Client applications not just RIA. Its very easy to declare a GUI and thanks to the closures for the events. With JavaFX we can create great GUI applications with awesome graphics.

The errors or bugs or flaws that the author number in this article It could be fixed right away but now we have to wait little bit until the Sun-Oracle deal is done.

Max Katz replied on Wed, 2009/07/29 - 2:28pm

What's been missing from JavaFX is enterprise server-side integration. RIA applications offer rich UI to the client, but they are connected to some server-side. Adobe has done a great job of pushing Flex into the enterprise. Many companies today use Flex to develop RIA applications. I know it might be early, but I'm still puzzled as to why all we see is how to create shapes and move them around the screen.

Max
http://mkblog.exadel.com

Otengi Miloskov replied on Wed, 2009/07/29 - 3:43pm in response to: Max Katz

Yeah that is a problem, Flex have backend services and webservices in the other hand JavaFX only webservices. But JavaFX can integtrate pretty well with Java code,  that is a plus so maybe soon we will see a nice integration solution for Java and JavaFX that can blow Flex away. JavaFX just need time I think to get little more mature, Now we have SDK for Linux and Solaris that is huge. Flex is more mature but JavaFX for a Java developer will be a better option in the future.

Max Katz replied on Wed, 2009/07/29 - 5:15pm in response to: Otengi Miloskov

Definitely, the ability to use any Java class on the client is a big plus but the question is how to connect to enterprise back-ends such as EJB3/Spring/Seam/JSR299.

Max
http://mkblog.exadel.com

Sergey Surikov replied on Thu, 2009/07/30 - 1:24am

I published first version of CRUDfx SDK.

This SDK allows you to resolve most technical issues in JavaFX.

The aim of the CRUDfx SDK is to create tools for CRUD applications development. It includes:

  • Layouts
  • Grid
  • Tree
  • Text/Password components
  • Localization tools
  • User preferences util
  • Tools for asynchronous task
  • Bridge to Web Services (XML, JSON)
  • Bridge to SQL Servers (JDBC)
  • Google Map component
  • Sound synthesizer
  • Other tools

Sources - http://code.google.com/p/crudfx/
Support - http://javafx.me
Demos - http://jfxstudio.wordpress.com/author/surikov/
Screenshots - 1, 2, 3, 4, 5

I think that with this library JavaFX can successfully compete with Flex/Air

 

Charles Ditzel replied on Thu, 2009/07/30 - 4:56pm

 Anyone that has been around the Java ecosystem for some years knows that the community goes through a  lot thrashing about and gnashing of teeth before things get put right.  I think JavaFX has a singular chance at this moment to put things right.  When I wrote my blog on JavaFX and my hopes around fixing it- I was hoping to see a couple of things :
> The first thing is to further the overall Java ecosystem by offering a real open source clientside Java alternative (open source, just like OpenJDK, NetBeans, Eclipse, etc) - instead of furthering a single Java-based framework.  So the two points I made that centered around this are open-sourcing (completely) of JavaFX and providing much better visibility into the roadmaps.
> The second thing, but, as important to many developers is to further Java on the client by creating true interoperability with JavaFX. Today, JavaFX can use Swing resources within a JavaFX application - the win for the ecosystem is in allowing true interoperability - where a Swing app can use JavaFX within it.  Without this two-way  interoperability JavaFX simply becomes a competitor to Flex and SilverLight  as opposed to a deeper part of the Java ecosystem.

In looking at the comments, I was happy to see that a number of people had a few more thoughtful additions to my comments.  One thing was one observation by tmilard was that some of the Swing apps looked very '90's.  No question that some of these apps use a fair amount of text - but I think we do need to draw a distinction between an app that is suppose to convey large amounts of information (textually) and an app that visually represents a DVD/CD cover with song titles. At the same time,  I don't agree that Swing apps *have* to look very 90's - there is plenty of good work demonstrated by Hans Muller, Pete Haase, Scott Violet, Romain Guy, Jasper Potts, Joshua Marinacci and many others that demonstrate that Swing apps can look quite good.

I mostly agree that Flex and JavaFX don't seem to lend themselves to say a ... heavily text-centric app often used in  banking, insurance, etc.  An app that is by it's nature is extremely text-centric is problematic for a framework that was built with rich media in mind.  Not to mention that an RCP add an additional aspect - modular development with large applications in mind.  I'm not saying writing the time keeper app in Flex or JavaFX can't happen  - just that it's harder to make it happen. So the comment about a 90's look may be a symptom of what the app is trying to accomplish. Many of us have become very accustomed to GUIs that are highly visual and media rich but have relatively small information content for the amount of screen real estate used.   Indaba's application really is the type of application where JavaFX can show itself off.  So I think there are apps that you want to build with JavaFX and their are apps you want to use an RCP for.  Geertjan pointed to Project Management App - this is the type of app that in some areas JavaFX would be especially ill-suited for but there might be other areas in app where JavaFX might be useful.  It's clear the RCP aspects are key aspects to the success of many apps.  Another example of using RCP is in the building of development environments.  Numerous  examples exist with NetBeans RCP - for example Sun Studio, LambdaBeans, Ruby IDE and of course the NetBeans IDE itself (and many others).  Obviously this is another example where JavaFX might be  ill-suited for many aspects - yet there may be visual areas where you might want to use it. It is  possible for someone  to write an IDE built in JavaFX but unfortunately it would lack access to a wealth of plugins available on today's RCP platforms.  Is this important. No, not if you live in a JavaFX-only world. But if you don't and you live a Java world were you might want to use plugins that leverage other services and APIs, then it will probably be important to you.  So from my perspective there are apps that would greatly benefit from both RCP aspects and JavaFX  at the same time in the same app.  However, without two-way interoperability this is not practical.  

I really think that the JavaFX framework which has as its underpinnings Java, Java2D and Swing should have as a simple Java ecosystem responsibility -  two-way interoperability.  In my mind the lack of this functionality disables a number of really interesting possibilities with the technologies and at the same time makes JavaFX a simple product rather than an integral part of a larger, interoperable ecosystem.  The  building of a Swing/JavaFX two-way ecosystem bridge  would allow not simply access to JavaFX from Swing (which in itself would be important) - but it would allow a much larger advantage in the form of coupling Rich Client Platforms - NetBeans, Eclipse and others to leverage it.  So when I said that the current one-way bridge that exists is "apparently artificial' - it gets to the heart of the fact that you have a Java/Java2D/Swing substrate that JavaFX sits and amazingly there no real way for Swing apps to leverage JavaFX despite all their commonality.  This is a shame because this would be the fastest way to adoption of JavaFX and would also provide an RCP coupling that would benefit JavaFX.  To adopt the current one-way bridge is a real failure of imagination which should be fixed.

It is quite clear that JavaFX has many excellent features - but let's get on with fixing some of the  issues that many would like to see fixed.

Note that an updated version of these comments are at my blog.
 

Rael G.C. replied on Thu, 2009/07/30 - 6:55am in response to: Max Katz

I think in a web environment, you'll use JSP/Servlet to generate the HTML that loads the JavaFX app, like people use PHP/Flash.

Anew Hope replied on Thu, 2009/07/30 - 12:06pm

JavaFX definitely has a future but my top concern is with the compiler and syntax.

Since JavaFX is close to Java and runs on the virtual machine, they could have augmented the compiler to accommodate Sequence, Scene, Timeline, Bind and Property assignment. The benefits of this would be numerous:

  • Facilitates acceptance into the OpenJDK project with minimal syntax changes and possible pre-processor.
  • Doesn't alienate Java developers since everything they know is still applicable to JavaFX except the new language constructs. In other words, they won't unecessarily trip on the syntax of JavaFX.
  • Binding and Property assignment could be used extensively... even without a UI!
  • All Swing components would be immediately available while new JavaFX style components are created to cover the basic Swing components
  • Oracle would be more apt to push JavaFX since it would be the advancement of Java rather than a recent Sun development that could be spun off or terminated.

Here's an example what could be done:

Example 1 Pure JavaFX

var color = Color.RED;
var radius = 0.0;
var circle = Circle {
centerX: 0
centerY: 0
opacity: 50
stroke: bind color
radius: bind radius
onMousePressed: function(event) {
color = if (color == Color.RED) Color.GREEN else Color.RED;
}
}

Example 2 Java with property assignment after construction (warning: this syntax does not actually exist)

Color color = new Color(Color.RED);
Number radius = new Number(0.0);
Circle circle = new Circle(): {
centerX: 0
centerY: 0
opacity: 50
stroke: bind color
radius: bind radius
onMousePressed(event): {
color = (color == Color.RED)?Color.GREEN:Color.RED;
}
}

Notice the ":" after Circle(). This indicates that the "{}" block that follows will be in the property assignment syntax. Also note that I changed the onMousePressed function syntax so that it is more java like and omits the "function" keyword. This syntax is only slightly wordier than the pure JavaFX syntax (strongly typed variables) but it takes the important syntax which is property assignment, binding, and a simplified event listener definition.

Example 3 Pure Java expanded from Example 2

Binder binder = new Binder();
Color color = new Color(Color.RED);
Number radius = new Number(0.0);
Circle circle = new Circle(); circle.setCenterX(0);
circle.setCenterY(0); circle.setOpacity(50);
binder.bind(color, "value", "stroke");
binder.bind(radius, "value", circle, "radius");
circle.addMouseListener(new MouseListenerAdapter() {
public void onMousePressed(Event event) {
color.setValue(circle.getValue().equals(Color.RED)?Color.GREEN:Color.RED);
}
});
Note that Binder is a class that would support property binding. Binding frameworks require a bit more explanation which is out of the scope of this post but suffice it to say that JavaFX supports binding and there are other frameworks that support it as well so we know that it is possible within a JVM.

I think that Java purists would write in the style of Example 3. Progressive developers would write in the style of Example 2 and this is really what JavaFX is aiming for. Unfortunately, we are currently stuck with the new syntax in Example 1 which causes confusion and prevent seamless integration with existing Java code.

Manjuka Soysa replied on Sun, 2009/08/02 - 2:13am

First, JavaFX is hardly a replacement for something like the NetBeans Platform or Eclipse RCP - its target, in my opinion, only fills a small but important segment: small rich media internet applications.

I think that sums it up. Not only is it important, but with smart phones and netbooks, it is a segment growing faster than other segments. May be the thinking is that JavaFX will fit in as a better alternative to Flash only in that market.

I hope they come up with a runtime for JavaFX that is very much smaller than the J2SE runtime - just enough for the core JavaFX classes. Forget about including Swing, io, and all other un-necessary stuff. I hope the modular VM will achieve this, so that developers who still want to target just the desktop can rely on the other J2SE libraries being downloaded.

The thinking previously has been to use Java on the client and server for 'write once run anywhere'. Clearly this was misleading as Java on smaller devices was J2ME - yes it is Java, but GUIs you write for desktops won't run on small devices. I think the vision is changing to use JavaFX on UI clients to truly achieve WORA.

Shoaib Abdullah replied on Mon, 2010/12/27 - 2:10am

The "rich web applications" boom was in 2000, when Flash arrived and we saw a lot of entirely website did using Flash. But people realized that build web systems must not be get paid to online confined to a proprietary plugin, and (thanks God!) entirely Flash websites are gone. And look: Flash has the most user-friendy IDE.

I see only new people in web development and Sun lovers talking about JavaFX passion. Things like "web don't have support for drag n' drop" or "web don't have support for mouse menu context". Did you  really used GMail? Ajax, drag n' drop, all in interior design a simple (not simplory) interface! And Flash don't have support for right mouse button menus (only play, stop, bw, fw, controls).

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.