This category provides articles regarding JavaFX as well as e(fx)clipse as this seems to be a good start to deal with JavaFX.
JavaFX has been around for some time now and Oracle is currently triying to enforce it as new standard for Java Rich Client Applications.
Regarding to a developer I know it has had some improvements over the years and it looks like it is going to be a try out worthy successor of AWT (Java), Swing (Java) and SWT (IBM).
Oracle pushes JavaFX
However Oracle is trying to push this somewhat new technology into the market for some time now, it has not yet been accepted by the Java community.
Root cause for this seem to be the following reasons.
- Companies are not asking for Rich Client Applications, but there is a trend for developing Web Applications. Therefore motivation to use anything like AWT, Swing, SWT or JavaFX is low except for private purposes. However JavaFX supports Mobile Applications, which is a big market. Since integration with mobiles is asked by companies as well for web applications and older technologies not supporting it, I can understand Oracle not wanting to provide support for it anymore. Of course this is just an assumption.
- Programmers are lazy. If you give them something completely new to learn, it takes quite an effort to get to a stage where you are as fast as using already known technologies. The standard platform for Java development, eclipse, is still not providing the same comfortable "what you see is waht you get editors" for JavaFX as it is providing for the older technologies. Until eclipse is not deprecating Swing and older technologies like SWT or even AWT they will be used by programmers.
Own experiences with JavaFX and interesting links
I did some research one the internet regarding JavaFX so far but I will try to write more articles in the future about it as I intend to write little tools for myself in Java. For this I of course do not want the hustle of maintaining a JEE server all the time. Therefore JavaFX is intersting for me but I am far from beeing an expert, so try it yourself.
Below I will simply list some advantages as well as disadvantages from my point of view.
Documentation and easy to use?
JavaFX in combination with e(fxclipse) is quite easy to use. I found a lot of documentation on the internet. Below some interesting links.
Main documentation page from Oracle.
How to use controls in JavaFX from Oracle.
How to use standard layout panes in JavaFX.
Finally we can forget about extra handling for Layouts like you know it from Swing!
Oracles reference on JavaFX CSS
e(fx)clipse is an open source project implemented for eclipse in order to support colour coding for JavaFX specific CSS or FXML, deployment of JavaFX applications as well as easy creation of new JavaFX projects in eclipse (less manual effort). I might have missed some stuff, but see for your self.
And here you can find a first tutorial after installing it. You will have to make sure to complete it successfully in order to make sure that your installation of eclipse is configured correctly for use of e(fx)clipse deployment.
One important workaround that helped me: Even when I configured eclipse to use the JDK path as default instead of the JRE path, I still was not able to succeed in "Generate ant build.xml and run". I had to completely delete the reference to the JRE path in the eclipse preferences.
To do so, go to Window - Preferences - Java - Installed JREs and Remove any JRE that is different from the JDK that you use for JavaFX projects.
Most likely this is not a good way to do it, but it could give better people than me a hint on fixing the bug by correct configuartion.
WYSIWYG Editor implemented by Oracle.
I will give this editor a try later, but for now I want to understand JavaFX in detail before using an editor like this.
Here an interesting blog post on sizing, automated growing and shrinking of controls in JavaFX.
What You See Is What You Get?
However JavaFX is not providing What You See Is What You Get editors in eclipse so far. At least I did not find one.
There seems to be an independent (not integrated into NetBeans or Eclipse) tool by Oracle, but I have not tried it yet.
JavaFX does not seem to provide a standard set of dialogs similar to JSomethingSomethingDialogs you might know from Swing. However there is an open source project called ControlsFX led by one of Oracle's JavaFX developers.
ControlsFX is an API for nice dialogs as for example the following picture shows and they seem easy to use with just one line commands.
Regarding to their website they only allow high quality code, which I believe is true. It looks very promising.
Here a detailed documentation on how to install and use ControlsFX in a blog I found.
Separation of application logic (Java), layout (FXML) and style (CSS)
JavaFX supports clean separation of UIs intoapplication logic implemented in Java, the layout implemented in Java or FXML and the style of an application implemented in CSS and / or Java.
I did not have a look at this yet, but it seems psomising. However, I hate XML - don't ask why, I just hate it.
Stay CLEAN! Debugging and exception handling?
However it is nice and good to separate application logic, layout and style of an user interface with JavaFX, this exposes the danger of loosing control of what happens at runtime.
Instead of having everything in one place you will have to put three places / files together in your head. That can make debugging quite a pain. However exceptions I have seen so far have also stated parsing erros in my CSS file including line number.
Therefore my tip: Do never start mixing responsibilities in between Java and the other two technologies. Either you handle the layout in FXML or in Java, but not in both. Same holds valid for FX CSS in combination with JavaFX. If you do not follow this approach you will end up searching in the wrong spot for a bug, confusing yourself.
So, separation yes, but once separated you stay that way. If you have a new girlfriend you do not hop into bed with the old one at the same time ;0).
JavaFX looks much better than Swing or older technologies
The standard UI stylesheets of FX are very nice and Oracle even provides you with very nice effects like reflections that are easy to use :0). It's as easy as switching reflection on a button or text on and off. They even provide you with animations.
Furthermore you are able to use style sheets, which gives you the freedom to do a lot with some simple commands. However I've never grown to like stylesheets, but hey: If someone places a nice stylesheet on the internet - even for a website, I can easily translate it into something that will work nicely for my applications.
So let others do the design for you even they do not know programming in Java. Hahahaha - nice! And for prove, see following link.