SlideShare ist ein Scribd-Unternehmen logo
1 von 40
Downloaden Sie, um offline zu lesen
1   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
JavaFX and Web Integration
            Kazuchika Sekiya
2           Java Embedded Global Business Unit, Oracle Japan
    Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
                                                                           English version
The following is intended to outline our general product direction. It is
intended for information purposes only, and may not be incorporated into any
contract. It is not a commitment to deliver any material, code, or functionality,
and should not be relied upon in making purchasing decisions. The
development, release, and timing of any features or functionality described for
Oracle’s products remains at the sole discretion of Oracle.




3   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Servers                            Desktop     Embedded      TV        Mobile     Card
                                                                                            BD-J
    Key APIs                    Java EE                              JavaFX               Java TV     MSA

    Platform                                                Java SE                         Java ME            Java Card

Language                                                                         Java Language
                                                                                 Java Platform
4    Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
What is JavaFX?
    Next Generation Java Client Solution




                  Media                                                                                     Web

             Audio/Video                                                                            HTML5/CSS3/JavaScript



                                                                                               Animations
                                                                                               Effects
                                                                           Advanced Graphics   3D
5   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
JavaFX 2.0 Architecture




6   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Agenda

    • Overview
    • API: WebEngine and WebView
    • Advanced Features




7   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
JavaFX Web Component

    • Full-fledged built-in browser
          –      HTML4, partial HTML5 support
          –      JavaScript engine
          –      LiveConnect
          –      DOM access
          –      SVG support




8   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Use Cases

    • Showing Web content
          – Remote content, locally generated content
    • Embedding Web applications
          – Using Java to control Web apps
          – Enhance Web apps by a variety of Java libraries




9   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Implementation Notes

     • Based on WebKit browser engine
           – Networking is implemented using java.net
           – Rendering is implemented using JavaFX (Prism)
     • Provided as a scene graph node
           – Effects, transforms and transitions can be applied




10   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Performance
     Windows
     • GUIMark2 HTML5 test http://www.craftymind.com/guimark2

                                                                            Vector Test      Bitmap Test           Text Test
                    Chrome
                                                                                    16.4                22.1                20.6
                    17.0
                    Firefox
                                                                                    12.2                 9.8                28.4
                    10.0.2
                    JavaFX
                                                                                    15.1                30.2                 5.8
                    2.0.3
                                                                      Windows 7 Professional / Intel Core 2 Duo 2.53GHz / RAM 4.0GB
11   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Performance
     Mac
     • GUIMark2 HTML5 test http://www.craftymind.com/guimark2

                                                                            Vector Test     Bitmap Test          Text Test
                    Chrome
                                                                                   16.9                 56                18.9
                    18.0
                    Safari
                                                                                     3.5              14.5                23.8
                    5.1.5
                    JavaFX
                                                                                   15.5               31.1                 7.0
                    2.1 beta b19
                                                                            Mac OS X 10.6.8 / Intel Core 2 Duo 2.13GHz / RAM 4.0GB
12   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
DEMO


13   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Agenda

     • Overview
     • API: WebEngine and WebView
     • Advanced Features




14   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
WebEngine and WebView




15   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
WebEngine
     package javafx.scene.web;
     • Non visual component
     • Provides following functions:
           – Loads Web pages
           – Runs scripts on pages
           – Manages DOM
     • Can be used without WebView




16   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
WebView
     package javafx.scene.web;
     • Is a scene graph Node
           – Used to display Web pages
     • Has an associated WebEngine
           – Created at construction time
           – Cannot be changed
           – WebView.getEngine()




17   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Key Methods of WebEngine

      Method                                                                Description
      void load(String url)                                                 Loads a Web page
      void loadContent(String content)                                      Loads the given HTML content
      void reload()                                                         Reloads the current page
      Worker getLoadWorker()                                                Returns a Worker to track loading
      Object executeScript(String script)                                   Executes a script
      Document getDocument()                                                Returns the DOM for current page




18   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Tracking of Web Page Loading
     package javafx.concurrent;
     • Loading is asynchronous
     • Use WebEngine.getLoadWorker() to track loading
           – state
                    • READY -> SCHEDULED -> RUNNING ->
                      SUCCEEDED/FAILED/CANCELED
           – progress (0…1)
           – workDone / totalWork
           – Can cancel() loading



19   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Basic Usage of Web Component

                                           import javafx.scene.web.WebView;
                                           import javafx.scene.web.WebEngine;

                                           WebView view = new WebView();
                                           // add WebView to scene graph
                                           // get WebEngine from WebView
                                           WebEngine engine = view.getEngine();

                                           // load a URL
                                           engine.load("http://javafx.com");



20   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
DEMO


21   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Agenda

     • Overview
     • API: WebEngine and WebView
     • Advanced Features




22   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
DOM (Document Object Model) Access

     • WebEngine.document property / getDocument() method
           – Initialized at some point before page is loaded
           – Read only
           – But you can modify the Document structure!




23   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Example: Modifying DOM



 Document = engine.getDocument();

 Element para2 = doc.getElementById("para2");
 Element newp = doc.createElement("p");
 newp.appendChild(doc.createTextNode("new paragraph"));
 para2.getParentNode().insertBefore(newp, para2);




24   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
DEMO


25   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
contentEditable

      • An attribute introduced in HTML5
      • To make region editable, do one of:

// use Element interface of DOM
inputLine.setAttribute("contenteditable", "true");

// or, casting to JSObject
((JSObject)inputLine).setMember("contentEditable", true)



 26   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
JavaScript Evaluation

       • WebEngine.executeScript() method
             – evaluate a JavaScript expression in the context of the current page



public String getPath() {
  return (String)webEngine.executeScript("location.pathname");
}




  27   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Translating JavaScript value to Java

      JavaScript                                                            Java
      null                                                                  null
      undefined                                                             “undefined”
      number                                                                java.lang.Number
                                                                            (Integer or Double)
      string                                                                java.lang.String
      boolean                                                               java.lang.Boolean
      object                                                                netscape.javascript.JSObject


28   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
JSObject
     package netscape.javascript;
     • Java wrapper around JavaScript object
     • Part of LiveConnect API

     Key Method                                                             Description
     Object getMember(String name)                                          Retrieves a named member
     void setMember(String name, Object value) Sets a named member
     void removeMember(String name)                                         Removes a named member
     Object call(String method, Object[] args)                              Calls a JavaScript method


29   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Node implements JSObject

     • DOM Node implementation also implements JSObject
           – same object wraps both the native WebKit (C++) DOM, and
             wraps JavaScripts DOM (which also wrap native DOM)
     • You do need to cast:

              Element inputLine = ...; // get an Element
              // use it as JSObject
              ((JSObject)inputLine).call("focus");




30   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Calling Java from JavaScript

     1. Create an interface object (of any class)
     2. Make it known to JavaScript by calling
        JSObject.setMember()
     ⇒You can call public methods from JavaScript




31   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Calling Java from JavaScript

class Bridge {
  public void exit() { Platform.exit(); }
}



JSObject jsobj = (JSObject)webEngine.executeScript("window");
jsobj.setMember("java", new Bridge());


<p>Click
<a href="" onclick="java.exit();">here</a>
to exit the application</p>

  32   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Threading

     • JavaFX, like Swing, is single-threaded
     • WebKit is single-threaded as well
     ⇒Web Component must only be accessed from the
       JavaFX application thread
           – use javafx.application.Platform.runLater() method




33   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
DEMO


34   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Control Google Map using Wii Remote


                                                                             WiiRemoteJ

                                                                              BlueCove               Google Map
                             Bluetooth


                                                                                 JavaScript API
                                                                                      call



                                                                                                  WebEngine/WebView
Wii Remote

 35   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Integrate Twitter4J library and HTML5 App



                                                                                                 HTML5 app
                                                                                                 “Ball Pool”
     Streaming API
                                                                            JavaScript call
                                                                             createBall()




                                                                                              WebEngine/WebView


36   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Summary
     JavaFX and Web Integration
     • JavaFX has powerful Web Component
           – WebKit based full-fledged built-in browser
                    • Partial HTML5 support
                    • High performance
           – APIs to integrate Java and Web apps
                    • JavaScript bridge
                    • DOM access
     ⇒You can produce new “mash-up”s of Web and Java!


37   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Acknowledgement

     • This presentation is mostly based on:
           – TS24313 “JavaFX 2.0 Web Component at a Glance”
                    • JavaOne 2011 San Francisco
                    • by Per Bothner, Peter Zhelezniakov
           – The JavaFX Blog: “Communicating between JavaScript and
             JavaFX with WebEngine”
                    • https://blogs.oracle.com/javafx/entry/communicating_between_javascri
                      pt_and_javafx
                    • by Peter Zhelezniakov


38   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
39   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
40   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Weitere ähnliche Inhalte

Was ist angesagt?

Java EE 8: On the Horizon
Java EE 8:  On the HorizonJava EE 8:  On the Horizon
Java EE 8: On the HorizonJosh Juneau
 
Modern web application development with java ee 7
Modern web application development with java ee 7Modern web application development with java ee 7
Modern web application development with java ee 7Shekhar Gulati
 
EuroPython 2011 - How to build complex web applications having fun?
EuroPython 2011 - How to build complex web applications having fun?EuroPython 2011 - How to build complex web applications having fun?
EuroPython 2011 - How to build complex web applications having fun?Andrew Mleczko
 
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0David Delabassee
 
Java EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsJava EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsMurat Yener
 
The Modern Java Web Developer - JavaOne 2013
The Modern Java Web Developer - JavaOne 2013The Modern Java Web Developer - JavaOne 2013
The Modern Java Web Developer - JavaOne 2013Matt Raible
 
Advance Java Tutorial | J2EE, Java Servlets, JSP, JDBC | Java Certification T...
Advance Java Tutorial | J2EE, Java Servlets, JSP, JDBC | Java Certification T...Advance Java Tutorial | J2EE, Java Servlets, JSP, JDBC | Java Certification T...
Advance Java Tutorial | J2EE, Java Servlets, JSP, JDBC | Java Certification T...Edureka!
 
HTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsHTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsJames Pearce
 
Java EE and Spring Side-by-Side
Java EE and Spring Side-by-SideJava EE and Spring Side-by-Side
Java EE and Spring Side-by-SideReza Rahman
 
Best Practices for JSF, Gameduell 2013
Best Practices for JSF, Gameduell 2013Best Practices for JSF, Gameduell 2013
Best Practices for JSF, Gameduell 2013Edward Burns
 
MWLUG - Universal Java
MWLUG  -  Universal JavaMWLUG  -  Universal Java
MWLUG - Universal JavaPhilippe Riand
 
5 best Java Frameworks
5 best Java Frameworks5 best Java Frameworks
5 best Java FrameworksAegis Softtech
 
Hybrid application development
Hybrid application developmentHybrid application development
Hybrid application developmentEngin Hatay
 
Wicket Deliver Your Webapp On Time
Wicket Deliver Your Webapp On TimeWicket Deliver Your Webapp On Time
Wicket Deliver Your Webapp On TimeWill Hoover
 

Was ist angesagt? (20)

XPages Mobile, #dd13
XPages Mobile, #dd13XPages Mobile, #dd13
XPages Mobile, #dd13
 
Java EE 8: On the Horizon
Java EE 8:  On the HorizonJava EE 8:  On the Horizon
Java EE 8: On the Horizon
 
Modern web application development with java ee 7
Modern web application development with java ee 7Modern web application development with java ee 7
Modern web application development with java ee 7
 
JavaCro'15 - Java EE 8 - An instant snapshot - David Delabassee
JavaCro'15 - Java EE 8 - An instant snapshot - David DelabasseeJavaCro'15 - Java EE 8 - An instant snapshot - David Delabassee
JavaCro'15 - Java EE 8 - An instant snapshot - David Delabassee
 
EuroPython 2011 - How to build complex web applications having fun?
EuroPython 2011 - How to build complex web applications having fun?EuroPython 2011 - How to build complex web applications having fun?
EuroPython 2011 - How to build complex web applications having fun?
 
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0
Java EE 8 Adopt a JSR : JSON-P 1.1 & MVC 1.0
 
Java EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsJava EE Revisits GoF Design Patterns
Java EE Revisits GoF Design Patterns
 
The Modern Java Web Developer - JavaOne 2013
The Modern Java Web Developer - JavaOne 2013The Modern Java Web Developer - JavaOne 2013
The Modern Java Web Developer - JavaOne 2013
 
Advance Java Tutorial | J2EE, Java Servlets, JSP, JDBC | Java Certification T...
Advance Java Tutorial | J2EE, Java Servlets, JSP, JDBC | Java Certification T...Advance Java Tutorial | J2EE, Java Servlets, JSP, JDBC | Java Certification T...
Advance Java Tutorial | J2EE, Java Servlets, JSP, JDBC | Java Certification T...
 
JavaCro'15 - HTTP2 Comes to Java! - David Delabassee
JavaCro'15 - HTTP2 Comes to Java! - David DelabasseeJavaCro'15 - HTTP2 Comes to Java! - David Delabassee
JavaCro'15 - HTTP2 Comes to Java! - David Delabassee
 
HTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsHTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applications
 
Java EE and Spring Side-by-Side
Java EE and Spring Side-by-SideJava EE and Spring Side-by-Side
Java EE and Spring Side-by-Side
 
Java Modularity: the Year After
Java Modularity: the Year AfterJava Modularity: the Year After
Java Modularity: the Year After
 
Best Practices for JSF, Gameduell 2013
Best Practices for JSF, Gameduell 2013Best Practices for JSF, Gameduell 2013
Best Practices for JSF, Gameduell 2013
 
MWLUG - Universal Java
MWLUG  -  Universal JavaMWLUG  -  Universal Java
MWLUG - Universal Java
 
5 best Java Frameworks
5 best Java Frameworks5 best Java Frameworks
5 best Java Frameworks
 
Agile toolkit present 2012
Agile toolkit present 2012Agile toolkit present 2012
Agile toolkit present 2012
 
01 java intro
01 java intro01 java intro
01 java intro
 
Hybrid application development
Hybrid application developmentHybrid application development
Hybrid application development
 
Wicket Deliver Your Webapp On Time
Wicket Deliver Your Webapp On TimeWicket Deliver Your Webapp On Time
Wicket Deliver Your Webapp On Time
 

Andere mochten auch

G* Workshop in Fukuoka - Introduction
G* Workshop in Fukuoka - IntroductionG* Workshop in Fukuoka - Introduction
G* Workshop in Fukuoka - IntroductionKazuchika Sekiya
 
お題でGroovyプログラミング: Part A
お題でGroovyプログラミング: Part Aお題でGroovyプログラミング: Part A
お題でGroovyプログラミング: Part AKazuchika Sekiya
 
API Meetupのこれまでとこれから
API MeetupのこれまでとこれからAPI Meetupのこれまでとこれから
API MeetupのこれまでとこれからAPI Meetup
 
minikura API がもたらした“予想外”な価値・課題
minikura API がもたらした“予想外”な価値・課題minikura API がもたらした“予想外”な価値・課題
minikura API がもたらした“予想外”な価値・課題minikura
 
APIエコノミーの現状と今後の期待
APIエコノミーの現状と今後の期待APIエコノミーの現状と今後の期待
APIエコノミーの現状と今後の期待Rasmus Ekman
 
Routeサービスを使ったCloud FoundryアプリのAPI管理
Routeサービスを使ったCloud FoundryアプリのAPI管理Routeサービスを使ったCloud FoundryアプリのAPI管理
Routeサービスを使ったCloud FoundryアプリのAPI管理Kazuchika Sekiya
 
OpenAPI Specification概要
OpenAPI Specification概要OpenAPI Specification概要
OpenAPI Specification概要Kazuchika Sekiya
 
Apigee+OASでらくらくAPI開発(予定)
Apigee+OASでらくらくAPI開発(予定)Apigee+OASでらくらくAPI開発(予定)
Apigee+OASでらくらくAPI開発(予定)Kazuchika Sekiya
 
NHK Linked Data API 〜つながる番組データを目指して〜
NHK Linked Data API 〜つながる番組データを目指して〜NHK Linked Data API 〜つながる番組データを目指して〜
NHK Linked Data API 〜つながる番組データを目指して〜API Meetup
 
[Azure Deep Dive] APIエコノミーに向けて ~Azure API ManagementによるAPIの公開と管理~ (2016/12/16)
[Azure Deep Dive] APIエコノミーに向けて ~Azure API ManagementによるAPIの公開と管理~ (2016/12/16)[Azure Deep Dive] APIエコノミーに向けて ~Azure API ManagementによるAPIの公開と管理~ (2016/12/16)
[Azure Deep Dive] APIエコノミーに向けて ~Azure API ManagementによるAPIの公開と管理~ (2016/12/16)Naoki (Neo) SATO
 
JavaStart - kurs Java Podstawy
JavaStart - kurs Java PodstawyJavaStart - kurs Java Podstawy
JavaStart - kurs Java PodstawyJavaStart
 
APIdays Australia 2017 TOI #APIdaysAU
APIdays Australia 2017 TOI #APIdaysAUAPIdays Australia 2017 TOI #APIdaysAU
APIdays Australia 2017 TOI #APIdaysAUTatsuo Kudo
 
Introducing Ballerina
Introducing BallerinaIntroducing Ballerina
Introducing BallerinaWSO2
 

Andere mochten auch (16)

G* Workshop in Fukuoka - Introduction
G* Workshop in Fukuoka - IntroductionG* Workshop in Fukuoka - Introduction
G* Workshop in Fukuoka - Introduction
 
お題でGroovyプログラミング: Part A
お題でGroovyプログラミング: Part Aお題でGroovyプログラミング: Part A
お題でGroovyプログラミング: Part A
 
JGGUG合宿2011報告
JGGUG合宿2011報告JGGUG合宿2011報告
JGGUG合宿2011報告
 
API Meetupのこれまでとこれから
API MeetupのこれまでとこれからAPI Meetupのこれまでとこれから
API Meetupのこれまでとこれから
 
シェアリングエコノミー推進に係る政府の取り組について(犬童周作)
シェアリングエコノミー推進に係る政府の取り組について(犬童周作)シェアリングエコノミー推進に係る政府の取り組について(犬童周作)
シェアリングエコノミー推進に係る政府の取り組について(犬童周作)
 
minikura API がもたらした“予想外”な価値・課題
minikura API がもたらした“予想外”な価値・課題minikura API がもたらした“予想外”な価値・課題
minikura API がもたらした“予想外”な価値・課題
 
Uberご紹介(髙橋正巳)
Uberご紹介(髙橋正巳)Uberご紹介(髙橋正巳)
Uberご紹介(髙橋正巳)
 
APIエコノミーの現状と今後の期待
APIエコノミーの現状と今後の期待APIエコノミーの現状と今後の期待
APIエコノミーの現状と今後の期待
 
Routeサービスを使ったCloud FoundryアプリのAPI管理
Routeサービスを使ったCloud FoundryアプリのAPI管理Routeサービスを使ったCloud FoundryアプリのAPI管理
Routeサービスを使ったCloud FoundryアプリのAPI管理
 
OpenAPI Specification概要
OpenAPI Specification概要OpenAPI Specification概要
OpenAPI Specification概要
 
Apigee+OASでらくらくAPI開発(予定)
Apigee+OASでらくらくAPI開発(予定)Apigee+OASでらくらくAPI開発(予定)
Apigee+OASでらくらくAPI開発(予定)
 
NHK Linked Data API 〜つながる番組データを目指して〜
NHK Linked Data API 〜つながる番組データを目指して〜NHK Linked Data API 〜つながる番組データを目指して〜
NHK Linked Data API 〜つながる番組データを目指して〜
 
[Azure Deep Dive] APIエコノミーに向けて ~Azure API ManagementによるAPIの公開と管理~ (2016/12/16)
[Azure Deep Dive] APIエコノミーに向けて ~Azure API ManagementによるAPIの公開と管理~ (2016/12/16)[Azure Deep Dive] APIエコノミーに向けて ~Azure API ManagementによるAPIの公開と管理~ (2016/12/16)
[Azure Deep Dive] APIエコノミーに向けて ~Azure API ManagementによるAPIの公開と管理~ (2016/12/16)
 
JavaStart - kurs Java Podstawy
JavaStart - kurs Java PodstawyJavaStart - kurs Java Podstawy
JavaStart - kurs Java Podstawy
 
APIdays Australia 2017 TOI #APIdaysAU
APIdays Australia 2017 TOI #APIdaysAUAPIdays Australia 2017 TOI #APIdaysAU
APIdays Australia 2017 TOI #APIdaysAU
 
Introducing Ballerina
Introducing BallerinaIntroducing Ballerina
Introducing Ballerina
 

Ähnlich wie [English version] JavaFX and Web Integration

How Scala, Wicket, and Java EE Can Improve Web Development
How Scala, Wicket, and Java EE Can Improve Web DevelopmentHow Scala, Wicket, and Java EE Can Improve Web Development
How Scala, Wicket, and Java EE Can Improve Web DevelopmentBruno Borges
 
What's New in WebLogic 12.1.3 and Beyond
What's New in WebLogic 12.1.3 and BeyondWhat's New in WebLogic 12.1.3 and Beyond
What's New in WebLogic 12.1.3 and BeyondOracle
 
Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Stephen Chin
 
Java keynote preso
Java keynote presoJava keynote preso
Java keynote presoArtur Alves
 
JavaFX 2 Rich Desktop Platform
JavaFX 2 Rich Desktop PlatformJavaFX 2 Rich Desktop Platform
JavaFX 2 Rich Desktop PlatformRajmahendra Hegde
 
Why should i switch to Java SE 7
Why should i switch to Java SE 7Why should i switch to Java SE 7
Why should i switch to Java SE 7Vinay H G
 
Development with JavaFX 9 in JDK 9.0.1
Development with JavaFX 9 in JDK 9.0.1Development with JavaFX 9 in JDK 9.0.1
Development with JavaFX 9 in JDK 9.0.1Wolfgang Weigend
 
Coding for Desktop and Mobile with HTML5 and Java EE 7
Coding for Desktop and Mobile with HTML5 and Java EE 7Coding for Desktop and Mobile with HTML5 and Java EE 7
Coding for Desktop and Mobile with HTML5 and Java EE 7Petr Jiricka
 
B1 roadmap to cloud platform with oracle web logic server-oracle coherence ...
B1   roadmap to cloud platform with oracle web logic server-oracle coherence ...B1   roadmap to cloud platform with oracle web logic server-oracle coherence ...
B1 roadmap to cloud platform with oracle web logic server-oracle coherence ...Dr. Wilfred Lin (Ph.D.)
 
WebLogic Developer Experience and Java EE 6
WebLogic Developer Experience and Java EE 6WebLogic Developer Experience and Java EE 6
WebLogic Developer Experience and Java EE 6Jeffrey West
 
Ugf9796 weblogic for ebs and obiee
Ugf9796 weblogic for ebs and obieeUgf9796 weblogic for ebs and obiee
Ugf9796 weblogic for ebs and obieeBerry Clemens
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applicationshchen1
 
Developing Java EE Applications on IntelliJ IDEA with Oracle WebLogic 12c
Developing Java EE Applications on IntelliJ IDEA with Oracle WebLogic 12cDeveloping Java EE Applications on IntelliJ IDEA with Oracle WebLogic 12c
Developing Java EE Applications on IntelliJ IDEA with Oracle WebLogic 12cBruno Borges
 
Building Java Desktop Apps with JavaFX 8 and Java EE 7
Building Java Desktop Apps with JavaFX 8 and Java EE 7Building Java Desktop Apps with JavaFX 8 and Java EE 7
Building Java Desktop Apps with JavaFX 8 and Java EE 7Bruno Borges
 
Paper published on web application testing with sahi tool
Paper published on web application testing with sahi toolPaper published on web application testing with sahi tool
Paper published on web application testing with sahi toolLalit Choudhary
 

Ähnlich wie [English version] JavaFX and Web Integration (20)

How Scala, Wicket, and Java EE Can Improve Web Development
How Scala, Wicket, and Java EE Can Improve Web DevelopmentHow Scala, Wicket, and Java EE Can Improve Web Development
How Scala, Wicket, and Java EE Can Improve Web Development
 
What's New in WebLogic 12.1.3 and Beyond
What's New in WebLogic 12.1.3 and BeyondWhat's New in WebLogic 12.1.3 and Beyond
What's New in WebLogic 12.1.3 and Beyond
 
Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5
 
Jspx Jdc2010
Jspx Jdc2010Jspx Jdc2010
Jspx Jdc2010
 
JavaOne Update zur Java Plattform
JavaOne Update zur Java PlattformJavaOne Update zur Java Plattform
JavaOne Update zur Java Plattform
 
Java keynote preso
Java keynote presoJava keynote preso
Java keynote preso
 
JavaFX 2 Rich Desktop Platform
JavaFX 2 Rich Desktop PlatformJavaFX 2 Rich Desktop Platform
JavaFX 2 Rich Desktop Platform
 
Why should i switch to Java SE 7
Why should i switch to Java SE 7Why should i switch to Java SE 7
Why should i switch to Java SE 7
 
Development with JavaFX 9 in JDK 9.0.1
Development with JavaFX 9 in JDK 9.0.1Development with JavaFX 9 in JDK 9.0.1
Development with JavaFX 9 in JDK 9.0.1
 
Java 2012 conference keynote - Java Strategy & Roadmap - WebLogic & GlassFish...
Java 2012 conference keynote - Java Strategy & Roadmap - WebLogic & GlassFish...Java 2012 conference keynote - Java Strategy & Roadmap - WebLogic & GlassFish...
Java 2012 conference keynote - Java Strategy & Roadmap - WebLogic & GlassFish...
 
Coding for Desktop and Mobile with HTML5 and Java EE 7
Coding for Desktop and Mobile with HTML5 and Java EE 7Coding for Desktop and Mobile with HTML5 and Java EE 7
Coding for Desktop and Mobile with HTML5 and Java EE 7
 
B1 roadmap to cloud platform with oracle web logic server-oracle coherence ...
B1   roadmap to cloud platform with oracle web logic server-oracle coherence ...B1   roadmap to cloud platform with oracle web logic server-oracle coherence ...
B1 roadmap to cloud platform with oracle web logic server-oracle coherence ...
 
WebLogic Developer Experience and Java EE 6
WebLogic Developer Experience and Java EE 6WebLogic Developer Experience and Java EE 6
WebLogic Developer Experience and Java EE 6
 
Java Cloud and Container Ready
Java Cloud and Container ReadyJava Cloud and Container Ready
Java Cloud and Container Ready
 
Ugf9796 weblogic for ebs and obiee
Ugf9796 weblogic for ebs and obieeUgf9796 weblogic for ebs and obiee
Ugf9796 weblogic for ebs and obiee
 
JavaOne 2010 Keynote
JavaOne 2010 Keynote JavaOne 2010 Keynote
JavaOne 2010 Keynote
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
 
Developing Java EE Applications on IntelliJ IDEA with Oracle WebLogic 12c
Developing Java EE Applications on IntelliJ IDEA with Oracle WebLogic 12cDeveloping Java EE Applications on IntelliJ IDEA with Oracle WebLogic 12c
Developing Java EE Applications on IntelliJ IDEA with Oracle WebLogic 12c
 
Building Java Desktop Apps with JavaFX 8 and Java EE 7
Building Java Desktop Apps with JavaFX 8 and Java EE 7Building Java Desktop Apps with JavaFX 8 and Java EE 7
Building Java Desktop Apps with JavaFX 8 and Java EE 7
 
Paper published on web application testing with sahi tool
Paper published on web application testing with sahi toolPaper published on web application testing with sahi tool
Paper published on web application testing with sahi tool
 

Mehr von Kazuchika Sekiya

10分でわかるOpenAPI V3
10分でわかるOpenAPI V310分でわかるOpenAPI V3
10分でわかるOpenAPI V3Kazuchika Sekiya
 
Apigee x Drupal: APIエコノミーを支える開発者ポータル
Apigee x Drupal: APIエコノミーを支える開発者ポータルApigee x Drupal: APIエコノミーを支える開発者ポータル
Apigee x Drupal: APIエコノミーを支える開発者ポータルKazuchika Sekiya
 
[JavaOne Tokyo 2012] JavaFX and Web Integration
[JavaOne Tokyo 2012] JavaFX and Web Integration[JavaOne Tokyo 2012] JavaFX and Web Integration
[JavaOne Tokyo 2012] JavaFX and Web IntegrationKazuchika Sekiya
 
「プログラミングGroovy」発売予告
「プログラミングGroovy」発売予告「プログラミングGroovy」発売予告
「プログラミングGroovy」発売予告Kazuchika Sekiya
 
「プログラミングGroovy」Groovyってなんだろ?編
「プログラミングGroovy」Groovyってなんだろ?編「プログラミングGroovy」Groovyってなんだろ?編
「プログラミングGroovy」Groovyってなんだろ?編Kazuchika Sekiya
 
GroovyなGAE/J Gaelykでかんたんbot工作
GroovyなGAE/J Gaelykでかんたんbot工作GroovyなGAE/J Gaelykでかんたんbot工作
GroovyなGAE/J Gaelykでかんたんbot工作Kazuchika Sekiya
 
Groovy/Grails on Google App Engine <シンプル導入編>
Groovy/Grails on Google App Engine <シンプル導入編>Groovy/Grails on Google App Engine <シンプル導入編>
Groovy/Grails on Google App Engine <シンプル導入編>Kazuchika Sekiya
 

Mehr von Kazuchika Sekiya (11)

10分でわかるOpenAPI V3
10分でわかるOpenAPI V310分でわかるOpenAPI V3
10分でわかるOpenAPI V3
 
Apigee x Drupal: APIエコノミーを支える開発者ポータル
Apigee x Drupal: APIエコノミーを支える開発者ポータルApigee x Drupal: APIエコノミーを支える開発者ポータル
Apigee x Drupal: APIエコノミーを支える開発者ポータル
 
[JavaOne Tokyo 2012] JavaFX and Web Integration
[JavaOne Tokyo 2012] JavaFX and Web Integration[JavaOne Tokyo 2012] JavaFX and Web Integration
[JavaOne Tokyo 2012] JavaFX and Web Integration
 
GroovyFX
GroovyFXGroovyFX
GroovyFX
 
GDK48
GDK48GDK48
GDK48
 
「プログラミングGroovy」発売予告
「プログラミングGroovy」発売予告「プログラミングGroovy」発売予告
「プログラミングGroovy」発売予告
 
「プログラミングGroovy」Groovyってなんだろ?編
「プログラミングGroovy」Groovyってなんだろ?編「プログラミングGroovy」Groovyってなんだろ?編
「プログラミングGroovy」Groovyってなんだろ?編
 
Gaelyk
GaelykGaelyk
Gaelyk
 
"G"はGrapeのG
"G"はGrapeのG"G"はGrapeのG
"G"はGrapeのG
 
GroovyなGAE/J Gaelykでかんたんbot工作
GroovyなGAE/J Gaelykでかんたんbot工作GroovyなGAE/J Gaelykでかんたんbot工作
GroovyなGAE/J Gaelykでかんたんbot工作
 
Groovy/Grails on Google App Engine <シンプル導入編>
Groovy/Grails on Google App Engine <シンプル導入編>Groovy/Grails on Google App Engine <シンプル導入編>
Groovy/Grails on Google App Engine <シンプル導入編>
 

Kürzlich hochgeladen

Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 

Kürzlich hochgeladen (20)

Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 

[English version] JavaFX and Web Integration

  • 1. 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 2. JavaFX and Web Integration Kazuchika Sekiya 2 Java Embedded Global Business Unit, Oracle Japan Copyright © 2012, Oracle and/or its affiliates. All rights reserved. English version
  • 3. The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 3 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 4. Servers Desktop Embedded TV Mobile Card BD-J Key APIs Java EE JavaFX Java TV MSA Platform Java SE Java ME Java Card Language Java Language Java Platform 4 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 5. What is JavaFX? Next Generation Java Client Solution Media Web Audio/Video HTML5/CSS3/JavaScript Animations Effects Advanced Graphics 3D 5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 6. JavaFX 2.0 Architecture 6 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 7. Agenda • Overview • API: WebEngine and WebView • Advanced Features 7 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 8. JavaFX Web Component • Full-fledged built-in browser – HTML4, partial HTML5 support – JavaScript engine – LiveConnect – DOM access – SVG support 8 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 9. Use Cases • Showing Web content – Remote content, locally generated content • Embedding Web applications – Using Java to control Web apps – Enhance Web apps by a variety of Java libraries 9 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 10. Implementation Notes • Based on WebKit browser engine – Networking is implemented using java.net – Rendering is implemented using JavaFX (Prism) • Provided as a scene graph node – Effects, transforms and transitions can be applied 10 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 11. Performance Windows • GUIMark2 HTML5 test http://www.craftymind.com/guimark2 Vector Test Bitmap Test Text Test Chrome 16.4 22.1 20.6 17.0 Firefox 12.2 9.8 28.4 10.0.2 JavaFX 15.1 30.2 5.8 2.0.3 Windows 7 Professional / Intel Core 2 Duo 2.53GHz / RAM 4.0GB 11 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 12. Performance Mac • GUIMark2 HTML5 test http://www.craftymind.com/guimark2 Vector Test Bitmap Test Text Test Chrome 16.9 56 18.9 18.0 Safari 3.5 14.5 23.8 5.1.5 JavaFX 15.5 31.1 7.0 2.1 beta b19 Mac OS X 10.6.8 / Intel Core 2 Duo 2.13GHz / RAM 4.0GB 12 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 13. DEMO 13 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 14. Agenda • Overview • API: WebEngine and WebView • Advanced Features 14 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 15. WebEngine and WebView 15 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 16. WebEngine package javafx.scene.web; • Non visual component • Provides following functions: – Loads Web pages – Runs scripts on pages – Manages DOM • Can be used without WebView 16 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 17. WebView package javafx.scene.web; • Is a scene graph Node – Used to display Web pages • Has an associated WebEngine – Created at construction time – Cannot be changed – WebView.getEngine() 17 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 18. Key Methods of WebEngine Method Description void load(String url) Loads a Web page void loadContent(String content) Loads the given HTML content void reload() Reloads the current page Worker getLoadWorker() Returns a Worker to track loading Object executeScript(String script) Executes a script Document getDocument() Returns the DOM for current page 18 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 19. Tracking of Web Page Loading package javafx.concurrent; • Loading is asynchronous • Use WebEngine.getLoadWorker() to track loading – state • READY -> SCHEDULED -> RUNNING -> SUCCEEDED/FAILED/CANCELED – progress (0…1) – workDone / totalWork – Can cancel() loading 19 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 20. Basic Usage of Web Component import javafx.scene.web.WebView; import javafx.scene.web.WebEngine; WebView view = new WebView(); // add WebView to scene graph // get WebEngine from WebView WebEngine engine = view.getEngine(); // load a URL engine.load("http://javafx.com"); 20 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 21. DEMO 21 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 22. Agenda • Overview • API: WebEngine and WebView • Advanced Features 22 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 23. DOM (Document Object Model) Access • WebEngine.document property / getDocument() method – Initialized at some point before page is loaded – Read only – But you can modify the Document structure! 23 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 24. Example: Modifying DOM Document = engine.getDocument(); Element para2 = doc.getElementById("para2"); Element newp = doc.createElement("p"); newp.appendChild(doc.createTextNode("new paragraph")); para2.getParentNode().insertBefore(newp, para2); 24 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 25. DEMO 25 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 26. contentEditable • An attribute introduced in HTML5 • To make region editable, do one of: // use Element interface of DOM inputLine.setAttribute("contenteditable", "true"); // or, casting to JSObject ((JSObject)inputLine).setMember("contentEditable", true) 26 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 27. JavaScript Evaluation • WebEngine.executeScript() method – evaluate a JavaScript expression in the context of the current page public String getPath() { return (String)webEngine.executeScript("location.pathname"); } 27 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 28. Translating JavaScript value to Java JavaScript Java null null undefined “undefined” number java.lang.Number (Integer or Double) string java.lang.String boolean java.lang.Boolean object netscape.javascript.JSObject 28 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 29. JSObject package netscape.javascript; • Java wrapper around JavaScript object • Part of LiveConnect API Key Method Description Object getMember(String name) Retrieves a named member void setMember(String name, Object value) Sets a named member void removeMember(String name) Removes a named member Object call(String method, Object[] args) Calls a JavaScript method 29 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 30. Node implements JSObject • DOM Node implementation also implements JSObject – same object wraps both the native WebKit (C++) DOM, and wraps JavaScripts DOM (which also wrap native DOM) • You do need to cast: Element inputLine = ...; // get an Element // use it as JSObject ((JSObject)inputLine).call("focus"); 30 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 31. Calling Java from JavaScript 1. Create an interface object (of any class) 2. Make it known to JavaScript by calling JSObject.setMember() ⇒You can call public methods from JavaScript 31 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 32. Calling Java from JavaScript class Bridge { public void exit() { Platform.exit(); } } JSObject jsobj = (JSObject)webEngine.executeScript("window"); jsobj.setMember("java", new Bridge()); <p>Click <a href="" onclick="java.exit();">here</a> to exit the application</p> 32 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 33. Threading • JavaFX, like Swing, is single-threaded • WebKit is single-threaded as well ⇒Web Component must only be accessed from the JavaFX application thread – use javafx.application.Platform.runLater() method 33 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 34. DEMO 34 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 35. Control Google Map using Wii Remote WiiRemoteJ BlueCove Google Map Bluetooth JavaScript API call WebEngine/WebView Wii Remote 35 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 36. Integrate Twitter4J library and HTML5 App HTML5 app “Ball Pool” Streaming API JavaScript call createBall() WebEngine/WebView 36 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 37. Summary JavaFX and Web Integration • JavaFX has powerful Web Component – WebKit based full-fledged built-in browser • Partial HTML5 support • High performance – APIs to integrate Java and Web apps • JavaScript bridge • DOM access ⇒You can produce new “mash-up”s of Web and Java! 37 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 38. Acknowledgement • This presentation is mostly based on: – TS24313 “JavaFX 2.0 Web Component at a Glance” • JavaOne 2011 San Francisco • by Per Bothner, Peter Zhelezniakov – The JavaFX Blog: “Communicating between JavaScript and JavaFX with WebEngine” • https://blogs.oracle.com/javafx/entry/communicating_between_javascri pt_and_javafx • by Peter Zhelezniakov 38 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 39. 39 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 40. 40 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.