Oracle Blog

Your source for all things JavaFX

Tuesday May 07, 2013

Following last year's JavaFX 1.2 and 1.3 End of Life announcement, we decided to postpone the decommission of Oracle's JavaFX 1.x download infrastructure by a few months to allow a handful of companies to finish migrating their applications to JavaFX 2.x. This was the case of SmartBear Software, who have released a new version of loadUI at the end of March.

However, we are still aware of a number of companies and individual developers who didn't have the resources to port their applications to the most recent version of JavaFX, or at least not by the time the EOL would take effect. We've then decided to put together a workaround that would allow third parties to redistribute the JavaFX 1.3.1 Runtime with their applications. This solution is available today, and in order to provide a transition period during which developer's can implement it, we have decided to postpone the EOL by a couple of more months. As you can see from the redistribution instructions, this is a relatively easy workaround to implement. What was more complex and time consuming was to update the license to allow for redistribution of JavaFX 1.3.1.

Thursday Feb 28, 2013

On April 3rd, 2013, JetBrains, the company behind IntelliJ IDEA, announced support for JavaFX in IntelliJ
IDEA 12.1, the latest version of their Java Integrated Development
Environment (IDE). Support for JavaFX includes complete support for FXML
markup, custom CSS, code completion, navigation and search,
refactorings, packaging tools. IntelliJ IDEA 12.1 also adds includes
integration with JavaFX
Scene Builder, Oracle's visual layout tool for JavaFX.

JavaFX development in IntelliJ IDEA

Coincidentally, the NetBeans team released the GA version of NetBeans IDE 7.3 on February 21st, which features, among other features, improved support for JavaFX Scene Builder, including improved FXML editing with code completion, and FXML controller generation. An increasing number of Java developers are using NetBeans to create new JavaFX applications, or migrating Swing and NetBeans RCP applications to JavaFX.

FXML code completion in NetBeans IDE

Eclipse users don't need to be jealous; e(fx)clipse provides a great JavaFX tool solution for Eclipse and OSGi, including integration with Eclipse JDT and Eclipse PDE, an FXML editor with code completion, and a JavaFX-proof CSS editor. Note that e(fx)clipse has been proposed as an Eclipse Foundation project.

e(fx)clipse CSS editor

It has never been a better time to develop rich client applications with Java; developers can now leverage even better support for JavaFX development in the leading Java IDEs, including NetBeans, Eclipse, and IntelliJ, as well as a number of specialized tools, utilities, and application frameworks.

Friday Aug 17, 2012

Earlier this week, Oracle released JavaFX 2.2, which is a
significant update release:

With version 2.2, JavaFX is finally available on
Windows (32-bit & 64-bit), Mac OS X (64-bit), and Linux (32-bit &
64-bit), which means that most developers can build and test JavaFX
applications on their preferred development environment. Have a look at the JavaFX
Certified System Configurations for more details.

The JavaFX 2.2 Runtime is now part of Oracle’s Java
SE 7u6 implementation. While we already had some form of integration between
these two products since December 2011, , we now have one unified installer,
with the JavaFX libraries installed alongside the Java SE libraries for both
the JDK and the JRE. This means a more streamlined user experience, and the
assurance for application developers that the number of computers capable of
running JavaFX applications will soon be as large as for Java SE applications.

A stand-alone implementation of JavaFX 2 will
remain available for Java SE 6 users, but only on Windows. Additionally, that
stand-alone version will no longer be supported when Java SE 6 reaches End of
Life (EOL) in February 2013. As explained
previously, this means there will no longer be bug fixes or security fixes
available for Java SE 6 users after that date, unless you or your customers
sign up for our commercial Java
SE Support offering. Otherwise, plan your migration to Java SE 7 right now.

Besides these important changes,
JavaFX 2.2 brings in some key new features:

JavaFX applications can now be redistributed as
self-contained application packages. These platform-specific packages include
all application resources and a private copy of Java and JavaFX Runtimes.
Distributed as a native installable package, they provide the same installation
and launch experience as native applications for that operating system. A key benefit to take into consideration is that it will
allow you to deploy JavaFX 2.2 applications bundled with Java SE 7 without
impacting existing deployments of older Java SE implementations.

Multi-touch
support for touch-enabled devices. As of today this is mostly relevant for desktop-class
touch screen displays and touch pads, this will enable the adoption of
sophisticated UIs on embedded devices running Java SE Embedded on ARM-based
chipsets, such as kiosks, telemetry systems, healthcare devices, multi-function
printers, monitoring systems, etc. This is a segment of the Java application
market that is usually overseen by most application developers, but that is
thriving.

The JavaFX Canvas API,
a Canvas 2D drawing surface that provides HTML5 Canvas-style operations.
Developers familiar with HTML5 will definitely be at ease with the JavaFX
Canvas API, although it is important to notice that this is not meant to be a
duplicate of the HTML5 Canvas Graphics API. We believe this API will also be
welcome by developers with other backgrounds, such as AWT or SVG. You can run a demo of the “Fireworks” canvas demo under the section “NEW!” of
the Ensemble sample application, or you can watch the making of another Canvas
example on this video.

JavaFX 2.2 introduces the ability to read and
write pixels to and from JavaFX image objects. An example is available as “Image
Operator” in the “NEW!” section of Ensemble.

Two new UI controls have been added to JavaFX
2.2: a color
picker, and a pagination
control; you can give them a try in the “NEW!” section of Ensemble. In addition, the WebView control now provides the ability
to manage web history. Finally, we have documented how to create a custom
control with FXML, which takes advantage of FXML enhancements.

HTTP Live
Streaming support is a feature that strengthens up JavaFX’s media support.
Essentially, media players are now able to switch to alternate video and audio streams,
as specified in a downloadable playlist file and based on network conditions.

Last but not the least, JavaFX developers can
now leverage the new JavaFX Scene
Builder 1.0 to visually layout an application UI, and generate FXML content
that helps keep a clean separation between application logic and UI. Scene
Builder is also a great example of a complex application written in JavaFX. It
is currently available on Windows and Mac OS X, and is optimized to work
seamlessly with NetBeans 7.2 or higher (it can also be used with other Java
IDEs).

In summary, JavaFX 2.2 is a key release that brings much
more than Linux support. It fulfills Oracle’s vision to integrate JavaFX with Java
SE to a large extent, and is a proof of our commitment for cross-platform
support and predictable timelines.

Sunday Mar 18, 2012

A few weeks ago, a poll on the home page of java.net caught my eyes, because it was related to JavaFX. Its title: Will you use JavaFX for development once it's fully ported to Mac and Linux platforms?

Usually, the results for this type of polls are published on the editor's Daily Blog soon after the poll closes. For some reason, this didn't happen for the JavaFX poll, so I'll take a shot at interpreting the results.

Although this way to look at the results already gives us an idea of how much traction JavaFX is getting, there are just too many type of answers that make it hard to read. The answers "maybe" and "I don't know" are awfully similar, so I'm tempted to collapse these together. Then there is "No, I don't do that type of development" that just doesn't belong here, as obviously developers who ave chosen this answer don't develop Rich Internet Apps, and therefore I will adapt the % results accordingly. Finally, I've been tempted to combine the top three categories just t simplify the results. This gives me the following chart:

Whether you prefer the original graph, or my simplified take on it, one thing is sure: less than 10% of developers who have taken this poll plan to stick to another toolkit (presumably Swing or SWT), while the vast majority is inclined to use JavaFX. When you take into account that JavaFX 2.0 is pretty much a "new" API (no more JavaFX Script), I think these are some pretty good results, 6 months after the official release of JavaFX 2.0.

Thursday Mar 15, 2012

Angela Caicedo, Oracle Technology Evangelist for JavaFX, has released a series of videos demonstrating how to build a simple JavaFX application using Netbeans 7.1. This video series is a great introduction to using JavaFX and takes the viewer through easy to follow, step-by-step instructions, including example code and showing the results along the way. These videos are highly recommend to anyone who is new to JavaFX and is looking for a quick getting started guide.

The first video provides an introduction to the the application and shows viewers the end result of the exercises that will be demonstrated throughout the series. The second video (Part 1) demonstrates how to get started creating the application from an empty project to build your first JavaFX application in Netbeans 7.1. Instructions include defining the components, creating and inserting image packages, adding the resources you want to make available in your application, setting the clipping area for you image, and setting the style for your image to create a transparent window. The third video (Part 2) demonstrates how to handle events and binding in the sample application using JavaFX.

Watch the first 3 episodes now and stay tuned for future installments in this series on the Java YouTube channel.

Tuesday Feb 28, 2012

Update: JavaFX 1.2 and JavaFX 1.3 Runtime Downloads to Remain Available Until End of March 2013

In order to allow specific companies to finalize the migration of their JavaFX Script-based applications to JavaFX 2, the JavaFX 1.2 and 1.3 Runtime products will remain available until the end of March, 2013, unless the server hosting these downloads is affected by a technical issue.

February 28, 2012

Original JavaFX 1.2 and JavaFX 1.3 EOL Announcement

Back in September 2010, during the JavaOne conference in San Francisco, Oracle announced they were discontinuing the JavaFX Script language. Oracle also committed to expose all the JavaFX functionality through a Java API, starting with the upcoming JavaFX 2.0 release. As promised, the Windows version of JavaFX 2.0 and the Developer Preview for Mac OS X were released in October 2011; a Developer Preview for Linux was added in January 2012.

Today, we are announcing that JavaFX 1.2 and
JavaFX 1.3 will reach end of life (EOL) on December 20, 2012. More specifically, the Oracle server providing
access to the JavaFX Runtime for these versions will no
longer be available after that date.

Because of the specific deployment architecture used for the JavaFX 1.x product line, this means that users of JavaFX 1.2 or 1.3 applications will no longer be able to download the JavaFX Runtime. Therefore, companies and developers who have JavaFX 1.x applications
in use today are strongly encouraged to migrate their applications
to the JavaFX 2, which is currently available on
Windows, Mac OS X and Linux. Extensive documentation,
tutorials, and samples are available on the JavaFX
Website, and a growing developer community has started sharing its experience and providing advise on forums,
blogs,
or social media.

Please refer to the JavaFX website for more information
about the current version of JavaFX. You may also discuss specific issues related to this announcement on the JavaFX OTN forum, which we monitor on a regular basis.

Friday Feb 24, 2012

JavaFX 2 has introduced the WebEngine and WebView classes to support modern Web standards such as JavaScript, CSS, SVG, and a subset of HTML5.

Besides browsing Web pages, WebEngine can also serve
as a container to host Web applications. Running standalone Web
applications inside JavaFX is not very exciting though. You can do the
same with any browser. What makes it interesting is the fact that the
a Web application can communicate with its hosting JavaFX application,
enabling a two-way communication channel. This article describes how
this channel works in the JavaFX 2.1 Developer Preview.

Invoking JavaScript from JavaFX

The Java application can pass arbitrary scripts to the JavaScript engine of a WebEngine object by calling the WebEngine.executeScript() method:

webEngine.executeScript("history.back()");

The script is executed within the context of the current page. The
result of the script invocation is converted to a Java type and
returned. For the primitive types, the conversion is straightforward:
integer values are converted to Integer, strings to String, etc. Most JavaScript objects are wrapped as instances of the netscape.javascript.JSObject class well-known to LiveConnect developers. Its methods are shown below:

This example shows an interesting aspect of extending the WebEngine functionality. The WebEngine API, as of writing this, is deliberately limited to just a few methods that are considered critically important. However, the WebEngine class supports the much broader JavaScript API. You can use the executeScript() and JSObject
methods to enable this second layer of API and get access to the
functionality you miss. So, while there's no a Java method like goBack(), a similar JavaScript method exists and can be invoked as in the above example.

The JSObject methods apply the same conversion rules to the values they return as executeScript(). For example, the following method returns an instance of java.lang.Integer:

history.getMember("length");

A special case is when a JavaScript call returns a DOM Node. In this case, the result is wrapped in an instance of JSObject that also implements org.w3c.dom.Node.

In this example, the script result is an Element object, and it is wrapped as org.w3c.dom.Element instance.

Making Upcalls from JavaScript to JavaFX

Since we are talking about a two-way communication channel, what
about making calls in the opposite direction: from a Web application
into JavaFX? On the JavaFX side, you need to create an interface object
(of any class) and make it known to JavaScript by calling JSObject.setMember(). Having performed this, you can call public methods from JavaScript and access public fields of that object.

First we need a JSObject to attach our interface object to. The above code uses the JavaScript window
object but any other object would work as well. Note that a cast is
necessary. Then we create an interface object and add it as a new member
of that JSObject. It becomes known to JavaScript under the name window.java, or just java, and its only method can be called from JavaScript as java.exit().
The upcall into Java is synchronous and occurs on the JavaFX
Application thread. The following HTML code enables exiting the JavaFX
application by clicking on a link:

Once you no longer need an interface object, you may want to call the JSObject.removeMember() method to make JavaScript "forget" it.

A Note about Security

Please be careful about functionality you open to JavaScript.
Remember, there is no sandbox for standalone applications. Methods
called by JavaScript on the interface object are invoked directly, as if
they were called from your JavaFX code. If your application enables
browsing arbitrary Web pages, a malicious script may take advantage of
the ability to run Java methods with the user's permissions. So you
probably do not want to write

jsobj.setMember("filesys", new File("/"));

as this would let scripts browse about the whole filesystem. By
carefully designing the interface object, you can always make sure that
only safe functionality is exposed. Another idea is to install and
configure a security manager in your application.

Tuesday Feb 21, 2012

JavaFX 2 was only released in October 2011, but there's already a thriving developer community kicking the tires of the new kid on the block, or busy developing new applications. There's no denying that we've pretty much started from scratch with JavaFX 2, and that we still have a lot of work ahead of us before we can claim victory.

But based on a number of indicators, JavaFX 2 benefits from the support of a growing number of developers. Let's have a look at some of these metrics.

JavaFX OTN Forum

There are currently two forums covering JavaFX. The first one covers JavaFX 1.x, and the activity on that forum has pretty much stopped several months ago, which was to be expected since JavaFX 1.3.1 is the last release supporting JavaFX Script.

On the other hand, the number of discussion threads on the "JavaFX 2.0 and later" forum has been growing steadily since the initial JavaFX 2 Beta for Windows was made available for download last May. A large number of the questions asked on the forum are answered by members of the JavaFX product team at Oracle, but an even higher number of threads involve non-Oracle employees. All in all, this is a sign of an healthy developer ecosystem: more and more developers start experimenting with JavaFX 2, ask questions on the forum, which should ultimately translate into more knowledgeable developers capable of building functional JavaFX applications.

Filing Bugs and Feature Requests

Another sign of a healthy developer ecosystem is the willingness of developers to report issues or submit a request for a new feature, rather than hoping someone else will do it, or moving away from JavaFX. For JavaFX 2, the developer community has contributed to an average of 20% of the activity in Jira since July, which is helping us produce better quality releases, since we can't possibly replicate all the software combinations in our QA lab.

Twitter

As many of you know, my Tweeter id is @javafx4you, and I try to do my best identifying the most interesting JavaFX-related announcements and blog posts to provide a stream of relevant information on Tweeter. Over time, a growing number of people interested in JavaFX are following me, and this number keeps growing. Of course this number is small compared to the number of followers for @java or @openjdk, but again JavaFX 2 is pretty new, and it's the trend that is interesting.

Blogs

I enjoy reading blog entries focusing on JavaFX, because it gives me an opportunity to see what other developers think of JavaFX, or discover new uses that we didn't originally envision. My biggest frustration is actually not being able to find out the real name and contact information for the person who has written a terrific blog entry about JavaFX, because I'd like to help put them in touch with our Java Magazine and OTN editor-in-chief, or simply set up a discussion with folks in our development team.

It's of course impossible to track all blogs that mention JavaFX, so I've decided to rely on the excellent summary "JavaFX links of the week" posted on a regular basis by Jonathan Giles. Not scientific, but good enough to se the trend in number of blog entries.

The challenge is of course to keep the trend going, and you can certainly play an important role. Remember: download, kick the tires, file issues, ask or answer questions in the forum, post your thoughts in blog entries, and release new apps!

Monday Jan 30, 2012

LCD sub-pixel text has become a must-have for many Windows desktop users, who have become accustomed to its superior legibility and less blocky appearance at smaller point sizes over hinted black and white text, and being sharper than grey scale anti-aliased text at the same size.

Java SE has supported LCD subpixel text on AWT heavyweights and also on Swing components using Java 2D for many years. However up until now, JavaFX has supported only more Mac OS X-like grey scale smoothed text.

For the JavaFX 2.1 release we've added the ability to use Windows-style LCD sub-pixel rendering. All the JavaFX UI controls will be LCD-text enabled by default on Windows, as will "WebView", the Webkit-based node for rendering Web content.

Applications can also opt-in to use LCD text on the low-level scenegraph "Text" node by a new API :

Text.setFontSmoothingType(FontSmoothingType.LCD));

Here is a fairly representative example of "before" and "after" LCD text on a Windows system:

1. WebView text rendering without LCD text support

2. WebView text rendering with CD text support

Note: make sure both images at being viewed at proper size (1020x700px). Depending on your browser DPI setting, your browser may scale images to fit, and the second image nay bnot display like the original.

Monday Jan 23, 2012

When we released the JavaFX 2.0 Beta at the end of May, there was an uproar from the Mac and Linux communities complaining that the software was only available on Windows. Developers were very vocal about the fact they would not touch JavaFX until this was remediated. Today, the JavaFX Team is very pleased to announce the availability of the JavaFX 2.1 Developer Preview for Linux, which you can download here.

The JavaFX Developer Preview for Linux has currently been tested against Ubuntu 10.04 / JDK 7u2 but is expected to be supported on other Linux distributions the Oracle Java SE implementation is available on when JavaFX for Linux reaches General Availability.

The quick summary is that it's time for you to code, test, and file bugs and feature requests. We are looking forward to your input to make JavaFX for Linux a rock-solid implementation, as we cannot possibly replicate software and hardware environments that are specific to you.

Monday Dec 14, 2009

If you haven't seen it yet, take a look at the fxexperience site. This blog site was created by key members
of the JavaFX team at Oracle, who provide insight into their
thoughts and experiences with JavaFX.

The people responsible for this site are:

Richard Bair: JavaFX architect

Jasper Potts: Design wizard and author of the Charts API in JavaFX.

Jonathan Giles: Developer on the JavaFX UI Controls team.

Richard, Jasper, and Jonathan are heavily involved in writing demos,
giving information on samples, docs, and books, linking to interesting
sites, and doing other things using JavaFX.

A weekly feature of the blog is the JavaFX links of the week, which provides links to JavaFX articles that have been published in the last week.