Disclaimer: I do not work for Oracle or represent Oracle in any way. This list of features is not official. This is just part of my research as an “outsider”.
Java 8 has become feature complete about two months ago and the developer preview is just around the corner (in a couple week’s time). This blog post will detail what’s coming in this next major release with an emphasis on JavaFX 8, which is the UI library. JavaFX release number is now on par with the Java release, that’s why it has jumped from 2.2 to 8.
This is part I of a three part series of posts. This first part will focus on what Oracle has officially been telling developers that should come out in JavaFX 8, the second part will be mostly speculative, and listing what I think might come out and is not officially being reported. And the final part focuses on the rest that’s coming to Java 8, excluding the UI library (e.g., new language features and such).
The original schedule aimed to ship the release in early September 2013, but due to the recent focus on browser-related security issues that date was not achieved. The new schedule is as follows:
- 2013/06/13 – Feature Complete
All features have been implemented and integrated into the master forest, together with unit tests.
- 2013/09/05 – Developer Preview
A reasonably stable build suitable for broad testing by the developer community is published. This build will include all planned features unless otherwise stated.
- 2014/01/23 – Final Release Candidate
The date by which the final release candidate must be declared and submitted for testing. One or more release candidates will be declared after the planned ZBB date; if another is necessary after this milestone then the General Availability date will be at risk.
- 2014/03/18 – General Availability
Final release, ready for production use.
To this let me add that I’ve been developing Java based apps under Java 8 for more than a month now and consider it to be quite stable. I’m also not using any of the features under development (like 3D graphics for example), so I can’t say anything for that part.
You can already get an early access release of JDK8 here: http://jdk8.java.net/download.html
On that site you can also download some sample apps, where you can get a glimpse of what’s already possible to do.
The following list will focus especially on the most relevant upcoming features. The list of all coming new features and changes to existing ones is particularly big in this release and it could be that some relevant ones might have escaped my attention and may not me mentioned.
Rich text support
Rich text support will be added in JavaFX 8 via TextFlow class.
This will allow you to:
- Style individual words;
- apply effects to words
- apply transforms
- embed nodes inside text
- support Bidi text, that is text containing text in both text directionalities, both right-to-left (RTL) and left-to-right (LTR)
- create text that can be individually styled via CSS
For more details visit this links:
- Rich text API Details: https://wikis.oracle.com/display/OpenJDK/Rich+Text+API+Details
- Samples and code snippets: https://wikis.oracle.com/display/OpenJDK/Rich+Text+API+Samples
Swing node will allow you to embed swing components inside a javafx scene. Support for the opposite, that is, embedding a javafx scene inside a swing app is already possible via JFXPanel.
For the API specification and a simple example visit: http://download.java.net/jdk8/jfxdocs/javafx/embed/swing/SwingNode.html
Changes to the controls API
Several changes will occur to the controls API, this is especially important to third party control providers:
- Skin class which will become public; SkinBase class will become public, but Behavior class and subclasses are still private implementation, there is still some work to be done here after JavaFX 8.
- New CSS API which will allow you to define custom properties for your controls and custom pseudo-classes – additional details can be found in: https://wiki.openjdk.java.net/display/OpenJFX/CSS+API+to+support+custom+UI+Controls
Video and audio recording
Support for video and audio recording will be added.
You can watch this video presentation for more details (jump to minute 39 to see an example app in action): http://www.youtube.com/watch?v=jaPUbzfJx2A
Printing support will be added to JavaFX. You can check this detailed blog post by Carl Dea for more details: http://carlfx.wordpress.com/2013/07/15/introduction-by-example-javafx-8-printing/
New looks with a new theme called Modena
The looks have been significantly improved with a new theme called Modena. This time a lot developer feedback was taken into account making for a very nice end result.
More details can be found here: http://fxexperience.com/2013/03/modena-theme-update/
New DatePicker and TreeTable controls
JavaFX 8 will have a DatePicker and a TreeTable control:
User experience documentation: http://openjdk.java.net/projects/openjfx/ux/datePicker/
Actual DatePicker screenshot:
Update: Jim Weaver has written about the DatePicker control, you can find his post here – http://learnjavafx.typepad.com/weblog/2013/08/quick-and-dirty-javafx-8-datepicker-example.html
User Experience documentation: https://wikis.oracle.com/display/OpenJDK/TreeTableView+User+Experience+Documentation
The following enhancements were added to WebView:
- WebSocket – http://javafx-jira.kenai.com/browse/RT-14947
- Web Workers – http://javafx-jira.kenai.com/browse/RT-9782
JavaFX will be included in Oracle’s Java SE Embedded 8. It will include a subset of features of the desktop version, namely it will not include:
- WebView support
- Media support
Workaround for media:
For media there is a workaround however, as this comment in FXExperience from Jasper Potts explains:
“There is no JavaFX media support on Pi, we prototyped passing
hardware decoded frames of video into OpenGL so that it could be drawn
in JavaFX Scene but performance was not great. So what we do is draw
JavaFX with a transparent background just like a transparent window on
desktop. Then use the native omx media player to play video to a lower
layer under the JavaFX graphics. So basically standard hardware overlay
graphics. This works great on PI and there is only about a 10% drop in
JavaFX performance when playing a HD video stream underneath. So simple
animations we can get 50+ fps with video at same time.”
Improved 3D support
Improved 3D support will be available in this release. Or it’s probably more accurate to say: true 3D support.
It is an optional feature, you can query the runtime to know whether it is available for the given platform. When JavaFX runs with software rendering this 3D features will not be available.
· Movable cameras and SubScene
- Camera is now a Node
Camera can be added to a scenegraph, its position and aim (or orientation) is set using standard transforms.
- Addition of SubScene
Subscene is a special node that can be used to render part of a scene with a different camera.
· 3D primitives
- Added two type of 3D shapes, extending from an abstract Shape3D base class:
- User-defined shapes (MeshView)
- Predefined shapes
Three commonly used predefined 3D shapes are introduced: Box, Cylinder and Sphere.
Shape3D class Hierarchy:
- javafx.scene.shape.Shape3D (abstract)
- javafx.scene.shape.Shape3D (abstract)
Mesh Class Hierarchy:
- javafx.scene.shape.Mesh (abstract)
- javafx.scene.shape.Mesh (abstract)
· 3D Attributes
- Added lights and 3D materials to add realism for 3D shapes.
Material specifies the appearance of a 3D shape. Light interacts with the geometry of a Shape3D and its material to provide the rendering result.
A Shape 3D can be rendered either as a filled shape or as a wireframe.
- Light is defined as a node in the scene graph
- There are 2 types of light sources:
AmbientLight: A light source that affects all objects equally. AmbientLight objects model the light reflected from other visual objects. If you look up at the underside of your desk, you will see the bottom surface of the desk although no light source is directly shining on that surface (unless you have a lamp under your desk). The light shining up on the bottom surface of the desk reflected off the floor and other objects. In natural environments with many objects, light reflects off many objects to provide ambient light. The AmbientLight class simulates this effect.
PointLight: A light source with a position. The distance and direction to a given object affects how this lights up the object. PointLight objects approximate bare light bulbs, candles, or other light sources without reflectors or lenses.
May add more types of lights in the future (example: spot light, a light that simulates light sources such as flash lights).
- A scene contains a set of active lights
A default light is provided when the set of active light is empty
- Each light contains a set of affected nodes
If a Parent is in the set, all its children are affected. The default is the root node of the Scene.
- Material contains a set of rendering properties
- PhongMaterial is a concrete subclass of Material. It has the following properties:
- Ambient color
- Diffuse color, diffuse map
- Specular color, specular map
- Specular power
- Bump map
- Self-illumination map
· Methods added to Node
- A LOD helper method that returns the area of the Node projected onto the physical screen in pixel units:
public double computeAreaInScreen()
LOD stands for Level of Detail. It is technique that changes the appearance of an object depending on how close or distant to the camera it is, or in other words the level of detail is changed according to the area occupied by the object if the object is far then the detail can be lowered without the user noticing it, and thus improving performance.
- A new set of methods that transform 3D points
· Loader support
Many 3D file formats exist, such as: Obj, Maya, 3D Studio Max, Collada, KRML. There will be no official 3D file format loaders shipping with the API. Oracle however will provide sample code for one or two popular formats. At least a Collada file loader is in the works.
- Oracle showed a cool proof of concept last JavaOne. It was built on an early JavaFX prototype with added 3D mesh, Camera and Lighting support. Also a simple 3D example (with code) is showed in this blog post: http://fxexperience.com/2013/02/javafx-3d-early-access-available/
- Another very neat sample app showed at last year JavaOne: http://www.youtube.com/watch?v=zFK0kpMpToM
- A presentation by Chien Yang and Kevin Rushforth from Oracle showed the state of art of the 3D javafx APIs. It’s a bit old so some things might have changed: http://www.youtube.com/watch?v=EBKHdV-_rIc
- Another presentation from Oracle that was done more recently (March 27, 2013), – Introduction to JavaFX 3D (sound quality and image quality is not so good). Again, some things might have changed (presentation starts at 43:18): http://www.youtube.com/watch?v=1Ebmy-JAygg&list=UUmRtPmgnQ04CMUpSUqPfhxQ&index=1#
Other minor features, tweaks and changes
Builders are deprecated
Builders are now deprecated in this release. In Java 9 they will be removed (this is several years down the road). You should start planning to replace builders if you are using them.
Due to an implementation detail, Builders would stop working in Java 8 unless some binary incompatibilities were introduced. Because of that the decision was to phase out the Builders, the changes that were required would reduce the value of the builders to the point where they just wouldn’t be worth it, and when considering Mobile / Embedded use cases, the extra cost of the builders would be prohibitive. (http://mail.openjdk.java.net/pipermail/openjfx-dev/2013-March/006725.html)
Javafx thread and swing will merge
JavaFX thread and swing can be merged, this is still an experimental API and will not be public, and you’ll have to turn it on explicitly. If you are developing a hybrid Swing/JavaFX app this will simplify the code since you only have to worry about one UI thread.
You can read more about this in this blog post: http://wiki.apidesign.org/wiki/JavaFX
JavaFX fully open sourced
JavaFX has just recently become fully open sourced. This is great news since it will allow third parties and developers to extend the functionality of JavaFX more easily and thoroughly. Also good for debugging errors, and other things.
JavaFX on the default classpath
This has been a recurring request from developers, JavaFX classes are now on the default runtime classpath for an Oracle Java implementation.