Saturday, February 18, 2012

Questions at My RMOUG Training Days 2012 Presentation on JavaFX 2

I presented "JavaFX 2.0: Java in the Rich Internet Application Space" at RMOUG Training Days 2012 earlier this week. After many years of presenting at technical conferences, I've decided that one of the best indicators of how well I did in my presentation is the types of questions I get from attendees. If I get no questions, it is more likely that I've confused, lost, or bored people than that I covered all possible questions. If I get really basic questions asking about things I already covered, it means I either messed that part of the presentation up or that I simply forgot to cover that thoroughly. When I get relevant questions that seem to pick up where my presentation left off or that demonstrate the attendee asking a question to apply what I've presented to an individual situation, I know that I've been able to provide what I had hoped to provide. The questions from attendees at my presentation this week fell into that last category. They were excellent questions.

In this post, I repeat (paraphrase) the questions (thanks Bill for recording them!) I was asked and provide answers to those questions. In most cases, I answer here pretty much the same way that I answered at the presentation (but with links here). One exception is my answer to the question about JavaFX 3D support, which has much more information provided in the answer in this post than I could provide at the presentation.

Q: What does JavaFX have for layout managers related to Swing and CSS?

One of the points I made in my presentation is that JavaFX 2 does a nice job of supporting industry standards such as Scalable Vector Graphics (SVG) and Cascading Style Sheets (CSS). An insightful attendee asked the question of whether JavaFX 2 uses Swing-like layout managers for layout or uses CSS for layout. My answer was that I had mostly seen (and had only used) JavaFX 2's layout panes for layout and I described these as akin to Swing's layout managers. I added that I have typically seen CSS used in JavaFX 2 applications for styling elements more than for layout purposes. CSS can be used to style many elements of the scene graph including nodes and even layouts. CSS can affect the layout panes by styling things such as padding and borders.

The document Working With Layouts in JavaFX (PDF) provides a nice introduction to JavaFX 2 layout techniques. JavaFX2.0 Layout: A Class Tour is another nice introduction to layout in JavaFX 2. Skinning JavaFX Applications with CSS (PDF) is a nice introduction to using CSS with JavaFX 2.

Q: What Does JavaFX Provide for Database Access?

With hindsight, I probably should have addressed JavaFX in context of database access at a conference that is heavily oriented to the Oracle Database. I suggested that because JavaFX is now "pure Java," it can easily be used with JDBC, favorite Java ORM tools (including JPA implementations), or other database-access goodies in alternative JVM languages such as Groovy.

I mentioned that the JavaFX community appears to be growing and its ecosystem is growing rapidly. I stated that I had just read this week about DataFX, "a project that intends to make retrieving, massaging, populating, viewing, and editing data in JavaFX UI controls easier." Although I have not used DataFX (currently at version 0.0.5), this may be something of interest for those wanting easier integration of data sources and JavaFX UI controls. The JavaOne 2011 slides for JavaFX Datasources: Getting Real-World Data into JavaFX Controls provide introductory details regarding DataFX.

Q: Will JavaFX become incorporated into ADF?

This question reminded my of a question that I too have had. Although I did not specifically wonder if Oracle would incorporate JavaFX into their Application Developer Framework, I have wondered if Oracle would incorporate JavaFX 2 into their products in general (believe they will) and into NetBeans (and NetBeans Rich Client Platform) in particular (less certain of this). I responded as such and said that I could only speculate, but that I hoped that they would incorporate JavaFX and gradually replace components that are heavily Swing-based with JavaFX. Given the statements at JavaOne 2011 regarding JavaFX essentially replacing Swing as the client-side UI technology, this would seem logical. It will obviously take quite some time to make this happen.

The post Oracle ADF and JavaFX demonstrates running "a JavaFX applet within an ADF application."

Q: Is there any out-of-box support for JavaFX 3D?

I mentioned in my slides that JavaFX 2 provides built-in and customizable 2D shapes. In response to the question related to JavaFX 2's 3D support, I responded that I wasn't aware of any existing JavaFX 2 API support for 3D graphics.

It appears that support for "3D primitives" has been anticipated for JavaFX 2.1. A Richard Bair podcast (Java Spotlight Episode 16) provides more information on the need to have Java 7 for applet (plugin) delivery changes to support Prism and 3D more fully. Under the section titled "New Features Proposed for JavaFX," the JavaFX 2 Roadmap has a sub-section called "3D Graphics Support" that states, "JavaFX will feature support for 3D graphics that can be leveraged for modern forms of data visualization and advanced user experience."

In addition, there are some other common practices for achieving 3D effects in JavaFX 2.0. These include use of Java 3D and using 2D shapes with creative animation to simulate 3D effects. Other good online resources related to JavaFX and 3D support (which JavaFX 1.x had) include 3D with JavaFX, Java 3D™ meets JavaFX™, 3D Capabilities in JavaFX 1.3 Release, JavaFX 2.0 for 3D Website, and Early reports on JavaFX 2 are in.

More JavaFX 2 Recent News

Because this is a JavaFX-oriented post, it seems appropriate to include references to some new online JavaFX content. Jonathan Giles announced that More of the JavaFX Scenegraph open sourced and he references specifically javafx-ui-common in the OpenJFX project.

The Apress page for the forthcoming book Pro JavaFX 2: A Definitive Guide to Rich Clients with Java Technology now states the publication date of this book as 7 March 2012. The Java-Buddy blog is featuring a series of numerous blog posts with simple JavaFX 2.0 examples and demonstrations.


I appreciated the great questions from attendees at my JavaFX 2 presentation at RMOUG Training Days 2012. They were such great questions that I thought it worth writing this post to summarize those questions and my best answers for those questions. I'm looking forward to the imminent release of Pro JavaFX 2 and am happy to see more of JavaFX open sourced and to see more JavaFX code examples online.


m1k0 said...

codecs like vpx, h264, ... I miss you... :(

@DustinMarx said...

Michael Heinrichs has posted a similar blog post called Most often asked questions about JavaFX in which he addresses questions about the relationship of Swing to JavaFX.

JewelseaFX said...

@m1k0 See MPEG-4 multimedia support in JavaFX: "With JavaFX 2.1, we are introducing playback support for digital media stored in the MPEG-4 multimedia container format containing H.264/AVC video and Advanced Audio Coding (AAC) audio."

@DustinMarx said...


Thanks for the update. The post MPEG-4 multimedia support in JavaFX contains exciting information about JavaFX 2.1's coming "playback support for digital media stored in the MPEG-4 multimedia container format containing H.264/AVC video and Advanced Audio Coding (AAC) audio."


Rihard Waters said...

Hi, please correct me if im wrong...there is no Touch-Swipe-Scroll support on Javafx??

This feature is now common for JavaFx not to support it by default.

We need such feature rather badly for our applications as requested by customers. To implement it by custom code is not a good decision for something so common now.

Apologies if this is not a right channel. Perhaps u can help bring it up to someone who can help improve javafx. Thanks.