JavaFX becomes the new HTML with WebFX
The big demo at JavaOne this year may have been the DukePad tablet, but it isn’t the only JavaFX proof-of-concept currently attracting attention.
Oracle evangelist Bruno Borges (pictured right) has been developing a browser in JavaFX that renders FXML pages, which can be then scripted using a variety of JVM languages.
“Of course it is ‘insane’ to think that this could replace HTML+WebKit engine”, the Brazilian developer told JAXenter over email. However, that hasn’t stopped him from putting together a functioning prototype, which he has shown off in screencasts and, more recently, at JavaOne 2013 (feedback was “really cool”, he says).
In addition to loading regular HTML pages using a WebView , WebFX’s killer feature is the ability to render web pages written in FXML, a variant of XML for designing JavaFX UIs. These are displayed as if they were regular HTML pages and are styled with CSS.
While obviously lacking HTML’s near-universal appeal, FXML has one advantage over HTML in its ability to provide custom components. “There is a movement in the HTML area to provide “Web Components” and <templates>, so I guess JavaFX was right,” wrote Borges (adding a friendly smiley on the end).
WebFX in action
In addition to the browser, Borges is writing a JavaFX component that can load FXML pages, equivalent in function to the native WebView component. The advantage of using an embedded FXML view, he says, is that it “can be easily updated without the need for compilation”. For JavaFX devs more familiar with FXML than HTML, this could potentially be more convenient than a WebView.
Still, while for Borges WebFX may currently be more of a tech demo, “the concept is there, the technology is available, all it is needed now is interest by someone else”. After all, the JavaOne audience shown WebFX thought “that this could come true one day,” the ever enthusiastic Borges added. “We don’t want the Web Innovation to stop at the HTML technology, right?”