Moving To The Client - JavaFX and HTML5

24
Moving to the Client - JavaFX and HTML5 Stephen Chin Chief Agile Methodologist, GXS [email protected] tweet: @steveonjava Kevin Nilson VP of Engineering, Just.Me [email protected] tweet: @javaclimber

description

Presentation on Jav

Transcript of Moving To The Client - JavaFX and HTML5

Page 1: Moving To The Client - JavaFX and HTML5

Moving to the Client - JavaFX and HTML5

Stephen ChinChief Agile Methodologist, [email protected]: @steveonjava

Kevin NilsonVP of Engineering, [email protected]: @javaclimber

Page 2: Moving To The Client - JavaFX and HTML5

About the Presenters

Stephen Chin

Chief Agile Methodologist, GXSAuthor, Pro JavaFX Platform

Java Champion

Kevin Nilson

Silicon Valley Web JUGSilicon Valley JS MeetupSilicon Valley Google Technology UG

Author Web 2.0 FundamentalsUser Groups Leader

Java Champion

Page 3: Moving To The Client - JavaFX and HTML5
Page 4: Moving To The Client - JavaFX and HTML5

History of the Web

1991 HTML1994 HTML 21996 CSS 1 + JavaScript1997 HTML 41998 CSS 22000 XHTML 12002 Tableless Web Design2005 AJAX2009 HTML 5

Page 5: Moving To The Client - JavaFX and HTML5

What is HTML5

> Web Hypertext Application Technology Working Group (WHATWG)

> HTML5 != HTML + CSS + JavaScript> HTML5 = Next Generation Features for Modern Web

Development

> Offline Storage, Web SQL Database, IndexedDB, Application Cache, Web Workers, WebSocket, Notifications, Native Drag & Drop, File System, GeoLocation, Speech Input, Form Types, Audio, Video, Canvas, SVG

Page 6: Moving To The Client - JavaFX and HTML5

HTML5 Rounded Corners

> http://slides.html5rocks.com/#rounded-corners

HTML5No HTML5

Page 8: Moving To The Client - JavaFX and HTML5

Prefixes

> -webkit-text-fill-color: black;> -webkit-column-count: 2;

> Before the Spec is final

> Before the Browser implementation is Verified

Page 9: Moving To The Client - JavaFX and HTML5

Cross Browser

> Browsers behave fairly differently

> HTML5 Non-Ambiguous Spec

> JavaScript Frameworks (jQuery, Dojo, YUI) give consistent API

Page 10: Moving To The Client - JavaFX and HTML5

Acid Test

> http://acid3.acidtests.org/

Page 11: Moving To The Client - JavaFX and HTML5

jQuery On The Rise> 49.58% of Top 10,000 sites use jQuery

(builtwith.com)

Page 13: Moving To The Client - JavaFX and HTML5

Reaching Older Browsers

> Chrome Frame IE6, IE7, IE8 running Chrome

> Modernizer Feature detection rather than User Agent Sniffing

Page 15: Moving To The Client - JavaFX and HTML5

JavaFX 2.0 Platform

Immersive Desktop Experience Combining the Best of JavaFX and HTML5

> Leverage your Java skills with modern JavaFX APIs

> Integrate Java, JavaScript, and HTML5 in the same application

> New graphics stack takes advantage of hardware acceleration for 2D and 3D applications

> User your favorite IDE: NetBeans, Eclipse, IntelliJ, etc.

Page 16: Moving To The Client - JavaFX and HTML5

> iPhone UIWebView Formatting Text

Indalo is an iPhone App Kevin Helped Write

Page 17: Moving To The Client - JavaFX and HTML5

> Titanium Write JavaScript, but

Renders Native Application

Many “Native” widgets are UIWebView

E*Trade API Contest App Kevin Wrote

Page 18: Moving To The Client - JavaFX and HTML5

Displaying HTML in JavaFX

public class WebViewTest extends Application { public static void main(String[] args) { launch(WebViewTest.class, args); } @Override public void start(Stage stage) { WebView webView = new WebView(); webView.getEngine().load("http://google.com"); Scene scene = new Scene(webView); stage.setScene(scene); stage.setTitle("Web Test"); stage.show();}}

18

Page 19: Moving To The Client - JavaFX and HTML5

Displaying HTML in JavaFX

19

Page 20: Moving To The Client - JavaFX and HTML5

Calling Javascript from JavaFX

String script = "alert('We've got a message, Houston!');”;eng.executeScript(script);

20

Page 21: Moving To The Client - JavaFX and HTML5

Responding to Browser Events

Supported Events:> Alert/Confirm/Prompt:

Respond to JavaScript user interaction functions> Resize:

Web page moves or resizes the window object> Status

Web page changes the status text> Visibility

Hide or show the window object> Popup

Spawn a second web view/engine21

Page 22: Moving To The Client - JavaFX and HTML5

HTML5/JavaFX Integration Demo

22

Page 23: Moving To The Client - JavaFX and HTML5

Pro JavaFX 2 Platform Coming Soon!

> Coming 4th quarter this year> All examples rewritten in Java> Covers new controls including:

WebPane TableView TreeView Etc.

> Content on ScalaFX/GroovyFX/Visage big announcement - come to my

Wednesday session23