javafx-1641810

Upload: samcarte

Post on 14-Apr-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 javafx-1641810

    1/38

    1 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

  • 7/30/2019 javafx-1641810

    2/38

    2 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Diving Into JavaFX 2.0

    Simon Ritter

    Technology Evangelist

  • 7/30/2019 javafx-1641810

    3/38

    3 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Java Pioneered Rich Client ApplicationBut developers had to learn multiple technologie

  • 7/30/2019 javafx-1641810

    4/38

    4 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    JavaFX Simplifies Application DevelopDevelopers Focus on Capabilities Instead of Tec

  • 7/30/2019 javafx-1641810

    5/38

    5 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    JavaFX is the Evolution of Java as a Rich Client

    It is designed to provide a modern Java environm

    featuring a lightweight, hardware accelerated UI that meets tomorrows needs.

  • 7/30/2019 javafx-1641810

    6/38

    6 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    JavaFX Runtime High Level Architectu

    JavaFX Glossary

    Glass Windowing Toolkit: Provides native operating servicesmanaging the windows, timers, and surfaces Prism: Graphics pipeline that can run on hardware and softwa Quantum Toolkit: Ties Prism and Glass together and makes t

    available to the JavaFX APIs

  • 7/30/2019 javafx-1641810

    7/38

    7 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    JavaFX 2.0 Scoreboard

    Releasedon*me(October2011)

    Allfunc*onalityexposedthroughJavaAPIs

    JavaFXandJavaScript/HTML5interoperability

    Highperformance2Dand3Dgraphicsengine

    DesignedtoexploitmodernadvancesindesktopandmMakeJavaFXUIControlsavailableopensource

    Completeandintegrateddevelopmentlifecycleexper

    Done v In progress

  • 7/30/2019 javafx-1641810

    8/38

    8 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Java APIs and FXML

    Java APIs for JavaFX

    End-to-end Java developmentJava language features - generics,annotations, multi-threading

    Fluent API for UI constructionAlternative JVM supported languages(e.g. Groovy, Scala) with JavaFX

    Leverage sophisticated Java IDEs,debuggers and profilersJava APIs preserve convenientJavaFX Script features (e.g., bind)

    FXML

    Scriptable, XML-based mlanguage for defining UI

    Convenient alternative to UI programmatically in Ja

    Easy to learn and intuitivedevelopers familiar with wtechnologies or other ma

    UI technologiesPowerful scripting featureembedding scripts within JVM scripting language c

    including JavaScript, GroScala

  • 7/30/2019 javafx-1641810

    9/38

    9 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    New hardware accelerated graphics pipeline (PNew windowing toolkit (Glass) for PrismJava2D software pipeline under PrismHigh-level support for making rich graphics sim

    Shadows, Blurs, Reflections, Effects, 2D transforms3D Transforms today; Full 3D objects in future

    New Graphics Pipeline

  • 7/30/2019 javafx-1641810

    10/38

    10 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Media

    Stable media framework based on GStreameVP6, MP3 playback of Web multimedia conteLow latency audioAlpha channel supportPerformance improvementsFull screen video

  • 7/30/2019 javafx-1641810

    11/38

    11 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Embed Web content in JavaFX applicationsHTML rendering based on WebkitHardware accelerated rendering using PRISMDOM access and manipulation

    WebView Component

  • 7/30/2019 javafx-1641810

    12/38

    12 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Embed JavaFX content into existing Swingapplications

    Extend existing Swing applications with newJavaFX features such as WebView and high-

    performance graphics

    Applies to SWT applications as well

    Swing and SWT Interop

  • 7/30/2019 javafx-1641810

    13/38

    13 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Faster loading of JavaFX Web applications bon Prism

    Pre-loader for improved user experience withJavaFX Web applications

    Browser Plugin

  • 7/30/2019 javafx-1641810

    14/38

    14 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Open Source and Standardization

    JavaFX source code being contributed as part http://openjdk.java.net/projects/openjfx/ Source code being contributed in phases Initial phase: UI Controls

    Oracle is committed to standardize JavaFX thro One or more JSRs will be submitted Expected to be become part of the Java SE specificat

  • 7/30/2019 javafx-1641810

    15/38

    15 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Distribution and Support

    JavaFX Distribution JavaFX Runtime can now be distributed with third par

    applications

    Applies to JavaFX 2.0.2 and higher JavaFX Platform Commercial Support

    JavaFX is now part of the Java SE technologies coveOracle Premier SupportApplies to JavaFX 2.0.2 and higher

  • 7/30/2019 javafx-1641810

    16/38

    16 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Lets Compare: JavaFX 1.x

    import javafx.application.*;import javafx.scene.shape.*;import javafx.scene.paint.*;

    Stage {scene:Scene{Content:[Circle {centerX: 50

    centerY: 50radius: 50fill: Color.RED

    }]

    }}

  • 7/30/2019 javafx-1641810

    17/38

    17 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Lets Compare: JavaFX 2.0

    public class JavaFXTest extends Application {@Override public void start(Stage stage) {

    Group root = new Group();Scenescene = new Scene(root,100,100);stage.setScene(scene);

    Circle c1 =new Circle(50.0f, 50.0f, 50.0f, Color.RED);

    root.getChildren().add(c1);

    stage.setVisible(true);}

    public static void main(String a[]) {Launcher.launch(JavaFXTest.class, null);

    }}

  • 7/30/2019 javafx-1641810

    18/38

    18 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Lets Compare: FXML

    public class JavaFXTest extends Application {@Override public void start(Stage stage) {stage.setTitle(FXML Example);

    Parent root = FXMLLoader.load(getClass().getResource(examResourceBundle.getBundle(r.fxml_example"));stage.setScene(new Scene(root));stage.show();

    }}

  • 7/30/2019 javafx-1641810

    19/38

    19 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Scene Graph

    Directed Acyclic Graph Parents and children Representation of the GUI components

  • 7/30/2019 javafx-1641810

    20/38

    20 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Media

    JavaFX supports both visual and audio media Cross-platform JavaFX media file format (fxm,

    Platform specific formats supported via native players Media class represents a media file MediaPlayer provides control of the media rend MediaView uses MediaPlayer to render media

    Many MediaViews can use the same MediaPlayer (ch

  • 7/30/2019 javafx-1641810

    21/38

    21 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Table

    Full featured table component Resizeable columns Columns can be moved Groups of columns can be moved

    Uses standard MVC pattern Create model for data Attach to Table view for display

    Efficient Lazy loading of data only displayed data is loaded

  • 7/30/2019 javafx-1641810

    22/38

    22 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Adding HTML Content

    WebEngine Provides basic web page browsing functionality Supports user interaction: navigating links, submitting

    WebView Web page as a Node in scenegraph

    Effects can be applied Encapsulates WebEngine object No plugin support

    The Embedded Browser

  • 7/30/2019 javafx-1641810

    23/38

    23 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Charts

  • 7/30/2019 javafx-1641810

    24/38

    24 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Effects...

    GaussianBlur

    InnerShadow

    SepiaTone

    Reflection

    f

  • 7/30/2019 javafx-1641810

    25/38

    25 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Transforms

    rect.setTranslateX(40);rect.setTranslateY(10);

    Rectangle rect=new Rectangle(0,0,60,60);rect.setFill(Color.DODGERBLUE);rect.setArcWidth(10);rect.setArcHeight(10);

    rect.setRotate(45);

    rect.setScaleX(2);rect.setScaleY(0.5);

    Shear shear = new Shear(0.7, 0);rect.getTransforms().add(shear);

    Bi di

  • 7/30/2019 javafx-1641810

    26/38

    26 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Binding

    Creates a dependency between a property andchangeable value

    High level API Easy to use Covers most common situations

    Low level APIAllows for more complex interactions Optimised for fast execution and small footprint

    P ti

  • 7/30/2019 javafx-1641810

    27/38

    27 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Properties

    Basis for high level binding API Concrete types for all primitives, String and Ob

    DoubleProperty, StringProperty, etc Simple API

    bind/ unbindbindBidirectional / unbindBidirectionalisBound

    Si l Bi di E l

  • 7/30/2019 javafx-1641810

    28/38

    28 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Simple Binding Example

    private SimpleDoubleProperty topXProperty =new SimpleDoubleProperty();

    private SimpleDoubleProperty topYProperty =

    new SimpleDoubleProperty();

    Line foldLine = new Line();foldLine.setEndX(200);foldLine.setEndY(200);foldLine.startXProperty().bind(topXProperty);

    foldLine.startYProperty().bind(topYProperty);

    ...

    topXProperty.set(tx);topYProperty.set(ty);

    Ti li B d A i ti

  • 7/30/2019 javafx-1641810

    29/38

    29 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Timeline Based Animations

    Timeline Modifies values of variables specified in KeyFrames

    KeyFrame: specifies that a variable should havA particular value at a particular time

    KeyValue: Value to be interpolated for an inte

    A i t d T iti

  • 7/30/2019 javafx-1641810

    30/38

    30 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Animated Transitions

    Pre-defined, single-purpose animations Fade, Path, Pause, Rotate, Scale, Translate Can specify to, from and by values

    Container transitions Parallel, sequential Can be nested arbitarily

    Transitions and Timelines share ancestaryA Timeline can be added to a Parallel / Sequential tra

    Swing Integration

  • 7/30/2019 javafx-1641810

    31/38

    31 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Swing Integration

    We are FINALLY supporting embedding of Javexisting Swing applications!

    Accomplishing this requires 3 objectives: Java APIs for JavaFXAbility to embed hardware accelerated 2D/3D scene Swing API for embedding the scene

    However, we are not going to support embeddSwing components in JavaFX scene graphs (a

    time)

    Standard Java Tools for Easy Developm

  • 7/30/2019 javafx-1641810

    32/38

    32 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Standard Java Tools for Easy Developm

    Source editor with improved synthighlighting, code completion, ref

    Full debugger and profiler suppo Project wizard for easy creation o

    applications

    Other Java IDEs Source editor with syntactic highlighting,code completion, refactoring etc.

    Full debugger and Profiler support

    JavaFX Scene Builder for Rapid UI Des

  • 7/30/2019 javafx-1641810

    33/38

    33 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    JavaFX Scene Builder for Rapid UI Des

    WYSIWYG GUI design tool for theJavaFX platform

    Enables designing user interfacescreens by simply dragging and

    positioning GUI components from a

    palette onto a scene

    Generates files in FXML format thatcan be used within a project in any IDE

    such as NetBeans or Eclipse Can be used to create GUI for desktop

    and Web applications

    Currently in Early Access (by invitation)

    JavaFX Future Directions

  • 7/30/2019 javafx-1641810

    34/38

    34 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    JavaFX Future Directions

    Tighter Integration with Java SE Migration Path for Java Client UI Technologies Optimized Web Services SupportAdvanced ToolingSupport for Modern Device Interactions

    Delivering on the Cross Platform Promise

    Oracles Next Generation Java Client Solution

    JavaFX is

  • 7/30/2019 javafx-1641810

    35/38

    35 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    JavaFX is

    Cross platform: Windows GA, Mac & Linux Dev Familiar: 100% Java APIs Powerful: leverages underlying Java platform Modern: CSS skinning, HW acceleration, WebkBackwards compatible: Swing & SWT interope

    Flexible: applicable to embedded, tablets and m Open Source: http://openjdk.java.net/projects/o

    JavaFX Roadmap

  • 7/30/2019 javafx-1641810

    36/38

    36 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    JavaFX RoadmapJavaFX Included Concurr

    (Window

    JavaFX

    Scene Builder GA

    NetBea JavaFX 3

    JavaFX 2.2 Linux GA

    JavaFX 2.1 Mac OS X GA Linux Dev. Preview

    2011 2012 2013

    JavaFX

    Scene Builder EA

    JavaFX 2.0 Windows GA Mac OS X Dev. Preview

    NetBeans 7.1 JavaFX 2.0 Support

    JavaFX 2.0.2 JDK 7 co-install

    Resources

  • 7/30/2019 javafx-1641810

    37/38

    37 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

    Resources

    JavaFX website: http://javafx.com Open source project

    http://openjdk.java.net/projects/openjfx/

    Oracle Premier Support for Softwarehttp://www.oracle.com/us/support/software/premier/

    Blogs http://fxexperience.com http://blogs.oracle.com/javafx

    Twitter: @javafx4you

  • 7/30/2019 javafx-1641810

    38/38

    38 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8