Wednesday Nov 21, 2012

Get Started with JavaFX 2 and Scene Builder

Up on otn/java is a very useful article by Oracle Java/Middleware/Core Tech Engineer Mark Heckler, titled, “How to Get Started (FAST!) with JavaFX 2 and Scene Builder.”  Heckler, who has development experience in numerous environments, shows developers how to develop a JavaFX application using Scene Builder “in less time than it takes to drink a cup of coffee, while learning your way around in the process”.

He begins with a warning and a reassurance: “JavaFX is a new paradigm and can seem a bit imposing when you first take a look at it. But remember, JavaFX is easy and fun. Let's give it a try.”

Next, after showing readers how to download and install JDK/JavaFX and Scene Builder, he informs the reader that they will “create a simple JavaFX application, create and modify a window using Scene Builder, and successfully test it in under 15 minutes.”

Then readers download some NetBeans files: contains the main application class. We won't do anything with this class for our example, as its primary purpose in life is to load the window definition code contained in the FXML file and then show the main stage/scene. You'll keep the JavaFX terms straight with ease if you relate them to the theater: a platform holds a stage, which contains scenes. is our controller class that provides the ‘brains’ behind the graphical interface. If you open the SampleController, you'll see that it includes a property and a method tagged with @FXML. This tag enables the integration of the visual controls and elements you define using Scene Builder, which are stored in an FXML (FX Markup Language) file.

Sample.fxml is the definition file for our sample window. You can right-click and Edit the filename in the tree to view the underlying FXML -- and you may need to do that if you change filenames or properties by hand - or you can double-click on it to open it (visually) in Scene Builder.”

Then Scene Builder enters the picture and the task is soon done.

Check out the article here.

Monday Sep 10, 2012

Expressing the UI for Enterprise Applications with JavaFX 2.0 FXML - Part Two

A new article by Oracle’s Java Champion Jim Weaver, titled “Expressing the UI for Enterprise Applications with JavaFX 2.0 FXML -- Part Two,” now up on otn/java, shows developers how to leverage the power of the FX Markup Language to define the UI for enterprise applications. Weaver, the author of Pro JavaFX Platform, extends the SearchDemoFXML example used in Part One to include more concepts and techniques for creating an enterprise application using FXML.

Weaver concludes the article by summarizing its content, “FXML provides the ability to radically change the UI without modifying the controller. This task can be accomplished by loading different FXML documents, leveraging JavaFX cascading style sheets, and creating localized resource bundles. Named parameters can be used with these features to provide relevant information to an application at startup.”

Check out the article here.

Wednesday Jun 20, 2012

Expressing the UI for Enterprise Applications with JavaFX 2.0 FXML - Part One

A new article, the first of two parts, now up on otn/java by Oracle Evangelist and JavaFX expert, James L. Weaver, titled “Expressing the UI for Enterprise Applications with JavaFX 2.0 FXML, Part One,” shows developers how to leverage the power of the FX Markup Language (FXML) to define the UI in enterprise applications.

As Weaver explains, “JavaFX 2.0 is an API and runtime for creating Rich Internet Applications (RIAs). JavaFX was introduced in 2007, and version 2.0 was released in October 2011. One of the advantages of JavaFX 2.0 is that the code can be written in the Java language using mature and familiar tools.”

He goes on to show how to use the potential of FX Markup Language, which comes with JavaFX 2.0, to efficiently define the user interface for enterprise applications. FXML functions to enable the expression of the UI using XML. “Classes that contain FXML functionality are located in the javafx.fxml package,” says Weaver, “and they include FXMLLoader, JavaFXBuilderFactory, and an interface named Initializable.”

Weaver’s article offers a sample application that shows how to use the capabilities of FXML and JavaFX 2.0 to create an enterprise app.

Have a look at the article here.

Monday Oct 17, 2011

JavaFX 2.0 Arrives and is Open Sourced

JavafxAmong the big news at JavaOne 2011 was the release of JavaFX 2.0 and announcement of its open source status. As Oracle’s Chief Architect, Client Java Platform Richard Bair observed, “We think this is going to be a really big deal in the industry.” JavaFX 2.0, touted as the next step in the evolution of Java as a rich client platform, is designed to provide a modern Java environment that shortens development time and eases the deployment of data driven-business and enterprise client applications.


Its key features include:


• Java APIs for JavaFX


• FXML -- an XML-based markup language for defining user interfaces


• Seamless integration into Swing applications


• High-performance hardware accelerated graphics


• Embedding of web content into JavaFX


• High-performance media engine


• Improved UI controls library


JavaFX 2.0 enables developers to leverage their existing Java skills and tools to develop JavaFX applications. It offers a clean separation of application UI and logic and simplifies code maintenance while integrating Web content and media seamlessly in Java applications. Developers can more easily create scalable, graphics-rich applications without performance penalties, build sophisticated user interfaces, extend existing Swing applications, and deploy applications in the browser, as desktop, or Web Start applications.


Java APIs for JavaFX include:


• End-to-end Java development


• Java language features—generics, annotations, multi-threading


• Reduced static footprint of runtime and applications


• Fluent API design for UI construction


• Development in alternative languages (e.g., JRuby, Groovy) with JavaFX


• Leverage sophisticated Java IDEs, debuggers and profilers


• Java APIs preserve convenient JavaFX Script features (e.g., bind)


Other features to take note of in JavaFX 2.0:




• Scriptable, XML-based markup language for defining user interfaces


• Convenient alternative to developing UI programmatically in Java


• Easy to learn and intuitive for developers familiar with web technologies or other markup based UI technologies


• Powerful scripting feature allows embedding scripts within a FXML file. Any JVM scripting language can be used, including JavaScript, Groovy, and Clojure, among others


New Graphics Pipeline for Modern GPUs


• New hardware accelerated graphics pipeline (Prism)


• New windowing toolkit (Glass) for Prism


• Java2D software pipeline for unsupported graphics hardware


• High-level support for making rich graphics simple: Shadows, Blurs, Reflections, Effects, 2D and 3D transforms



Rich Set of UI Controls


• Over 50 components for form-based UI, including charts, layout and form controls


• CSS3+ skinning and layout of UI controls


• Advanced UI controls, including table, tree view, rich text editor



Web Component


• Embed Web content in JavaFX applications


• HTML and JavaScript rendering based on Webkit


• DOM access and manipulation from Java



Browser Plug-in Refreshed for JavaFX 2.0


• Loading of JavaFX applets based on Prism


• Preloader for JavaFX applets for improved user experience



Powerful Properties Model


• New collections ObservableList, Sequence and ObservableMap


• New design and implementation of bean properties


• Low level binding API for high performance, low footprint bindings


• High level binding API for simple usage



Improved Animation Engine


• Optimized implementation of transitions


• Complete overhaul of API to simplify usage and in preparation of optimized and more stable implementation



Approximately 50 JavaFX 2.0 sessions can be found at JavaOne given by leading JavaFX movers and shakers. JavaFX is the next step in the evolution of Java as a rich client platform. Congratulations to all involved!  


Insider News from the Java Team at Oracle!



« October 2015