Benedicto Fernandez Software Engineer CERN / GS-AIS Dubna 2012.

Slides:



Advertisements
Similar presentations
INTRODUCTION TO JAVAFX CS12420 – Software Development Andrei Stanica (modified ltt)
Advertisements

Introduction To Java Objectives For Today â Introduction To Java â The Java Platform & The (JVM) Java Virtual Machine â Core Java (API) Application Programming.
1. JavaFX 2.0 Simon Ritter Technology Evangelist.
Lessons learnt developing a NetBeans PDF viewer plugin in JavaFX Ernest Duodu Sylwia Kedzia.
Java Applet & JavaScript SNU OOPSLA Lab. October 2005.
Mark Dixon, SoCCE SOFT 131Page 1 20 – Web applications: HTML and Client-side code.
ACTIVE X By Ethan Huang. OUTLINE What is ActiveX? Component of ActiveX Why ActiveX? ActiveX and Java Security Issue.
Principles of Object-Oriented Software Development The language Java.
Google Android as a mobile development platform T Internet Technologies for Mobile Computing Olli Mäkinen.
Embedding - for better collaborations - Toshiyuki Takahei RIKEN.
Lab 1 Instructor: Jolanta Soltis.
1Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8.
Define objects and their relationships to multimedia Explain the fundamentals of C, C++, Java, JavaScript, JScript, C#, ActiveX and VBScript Discuss security.
01 Introduction to Java Technology. 2 Contents History of Java What is Java? Java Platforms Java Virtual Machine (JVM) Java Development Kit (JDK) Benefits.
Introduction to Java Programming. Contents 1. Java, etc. 2. Java's Advantages 3. Java's Disadvantages 4. Types of Java Code 5. Java Bytecodes 6. Steps.
Written by Liron Blecher
Copyright © 2012 Certification Partners, LLC -- All Rights Reserved Lesson 5: Multimedia on the Web.
JavaFX Updates in Java 8 3D and Webview By Rob Ratcliff
1. 2 What’s New in NetBeans IDE What is NetBeans IDE?  Ready to use out of the box  Support for latest Java specifications & standards  Other.
1Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8.
RIA & Adobe Flex Yunhui Fu 11/05/2008. What’s RIA RIA (Rich Internet Applications) –web applications which look and perform like desktop applications.
Lecturer PEN PHIROM Tel : Web site: Lecturer PEN PHIROM Tel :
NASRULLAH KHAN.  Lecturer : Nasrullah   Website :
DUE Hello World on the Android Platform.
Applets and Frames CS 21a: Introduction to Computing I First Semester,
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
POS 406 Java Technology And Beginning Java Code
1 Programming Fundamentals AITI-GP. 2 Introduction to Programming.
Ch 1. A Python Q&A Session Spring Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.
CS 3131 Introduction to Programming in Java Rich Maclin Computer Science Department.
2006 Adobe Systems Incorporated. All Rights Reserved. 1 Adobe RIA Technologies: Adobe Flex 3 Cornel Creanga Platform Evangelist
1 After completing this lesson, you will be able to: Transfer your files to the Internet. Choose a method for posting your Web pages. Use Microsoft’s My.
CSC 205 – Java Programming II Applet. Types of Java Programs Applets Applications Console applications Graphics applications Applications are stand-alone.
Overview of Silverlight Mike Taulty Developer & Platform Group Microsoft Ltd
Creating Rich Desktop applications with JavaFX Smart, easy and fast Stefan Vadev Technical Trainer Software University
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
Introduction to Java The Java Platform, The Java Language, JDK, Eclipse Svetlin Nakov Technical Trainer Software University
Service Side Ajax Richard Schmidt gmail. Com Metservice.
Lec 08 Agenda Go over exam Introduction to proFinal (Game Features) proBlackJack (Jerry and Alex to present) JavaFX Intro.
Applets and Frames. Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved L14: GUI Slide 2 Applets Usually.
Topics Introduction Scene Graphs
JAVA Programming “When you are willing to make sacrifices for a great cause, you will never be alone.” Instructor: รัฐภูมิ เถื่อนถนอม
The Java Platform, The Java Language, JDK, IntelliJ
Internet Technologies1 Internet Technologies JavaFX.
NASRULLAH KHAN.  Lecturer : Nasrullah   Website :
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved. 1 Chapter 14 JavaFX Basics.
3/5/2002e-business and Information Systems1 Java Java Java Virtual Machine (JVM) Java Application Program Interface (API) HW Kernel API Application Programs.
Java How to Program, 10/e © Copyright by Pearson Education, Inc. All Rights Reserved.
Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved. 1 Chapter 14 JavaFX Basics.
Lecture 7:Introduction to JavaFX Michael Hsu CSULA.
Va installato Qui le istruzioni
Lecture 12 CS 202. FXML JavaFX also offers a way to code UI controls in XML, while writing the event handlers and other application logic in Java. The.
Lecture 7:Introduction to JavaFX Michael Hsu CSULA.
1Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8.
Lecture 18 CS
Java FX: Scene Builder.
Java Programming Java FX.
Lecture 7:Introduction to JavaFX
Internet and Java Foundations, Programming and Practice
30 Java Applets.
EE 422C Java FX.
Getting Started ARCS Lab..
CISC124 Last Quiz this week. Topics listed in last Tuesday’s lecture.
What you should already know…. (Appendices C, D, and E)
Lecture 9 GUI and Event Driven CSE /16/2019.
Lesson 5: Multimedia on the Web
ㅡ.
Using JavaFX Applications
from Lutz Dietrich and Hans Kluge
Presentation transcript:

Benedicto Fernandez Software Engineer CERN / GS-AIS Dubna 2012

Contents What is JavaFX? History What’s new in JavaFX 2.X? Architecture What’s coming next? Examples Deployment

What is JavaFX? (I)

What is JavaFX? (II) Rich sets of graphics and media API Cross-Platform Deploy on the Desktop or in the browser

What can I build with JavaFX?

History JavaOne Announce JavaFX JavaFX 1.0 JavaOne End of JavaFX Script JavaOne JavaFX 2.0

JavaFX Roadmap JavaFX 2.0 Windows GA Mac OS X Dev. Preview JavaFX 2.0 Scene Builder EA JavaFX JDK 7 co-install NetBeans 7.1 JavaFX 2.0 Support JavaFX 2.1 Mac OS X GA Linux Dev. Preview JavaFX 2.2 Linux GA JavaFX Scene Builder GA JavaFX 3.0 Included in JDK 8 Concurrent OS support (Windows, Mac OS, Linux) NetBeans JavaFX 3.0 Support

What’s new in JavaFX 2.0? New graphics and media engine FXML Web component Wide variety of built-in UI controls Refreshed browser plug-In

Architecture JavaFX Public API’s and Scene Graph Quantum Toolkit Prism Glass Windowing Toolkit Media Engine Web Engine Java 2D Open GL D3D Java Virtual Machine

Architecture JavaFX Public API’s and Scene Graph Quantum Toolkit Prism Glass Windowing Toolkit Media Engine Web Engine Java 2D Open GL D3D Java Virtual Machine

Architecture JavaFX Public API’s and Scene Graph Quantum Toolkit Prism Glass Windowing Toolkit Media Engine Web Engine Java 2D Open GL D3D Java Virtual Machine

Architecture JavaFX Public API’s and Scene Graph Quantum Toolkit Prism Glass Windowing Toolkit Media Engine Web Engine Java 2D Open GL D3D Java Virtual Machine

Architecture JavaFX Public API’s and Scene Graph Quantum Toolkit Prism Glass Windowing Toolkit Media Engine Web Engine Java 2D Open GL D3D Java Virtual Machine

Architecture JavaFX Public API’s and Scene Graph Quantum Toolkit Prism Glass Windowing Toolkit Media Engine Web Engine Java 2D Open GL D3D Java Virtual Machine

What’s coming next? Tighter Integration with Java SE (JSE 8) Improvements to UI Controls and Charts Data Services Support Modularization Accessibility Support Multi-Touch and Gestures Support Sensor Support

Examples

Example – Hello World public class JavaFXApplication1 extends Application { /** args the command line arguments */ public static void main(String[] args) { launch(args); public void start(Stage primaryStage) { // Set window's title primaryStage.setTitle("Hello World!"); // Create a button Button btn = new Button(); btn.setText("Say 'Hello World'"); btn.setOnAction(new EventHandler () public void handle(ActionEvent event) { System.out.println("Hello World!"); } }); StackPane root = new StackPane(); root.getChildren().add(btn); primaryStage.setScene(new Scene(root, 300, 250)); primaryStage.show(); }

Example – Hello World public class JavaFXApplication1 extends Application { /** args the command line arguments */ public static void main(String[] args) { launch(args); public void start(Stage primaryStage) { // Set window's title primaryStage.setTitle("Hello World!"); // Create a button Button btn = new Button(); btn.setText("Say 'Hello World'"); btn.setOnAction(new EventHandler () public void handle(ActionEvent event) { System.out.println("Hello World!"); } }); StackPane root = new StackPane(); root.getChildren().add(btn); primaryStage.setScene(new Scene(root, 300, 250)); primaryStage.show(); }

Example – Hello World public class JavaFXApplication1 extends Application { /** args the command line arguments */ public static void main(String[] args) { launch(args); public void start(Stage primaryStage) { // Set window's title primaryStage.setTitle("Hello World!"); // Create a button Button btn = new Button(); btn.setText("Say 'Hello World'"); btn.setOnAction(new EventHandler () public void handle(ActionEvent event) { System.out.println("Hello World!"); } }); StackPane root = new StackPane(); root.getChildren().add(btn); primaryStage.setScene(new Scene(root, 300, 250)); primaryStage.show(); }

Example – Hello World public class JavaFXApplication1 extends Application { /** args the command line arguments */ public static void main(String[] args) { launch(args); public void start(Stage primaryStage) { // Set window's title primaryStage.setTitle("Hello World!"); // Create a button Button btn = new Button(); btn.setText("Say 'Hello World'"); btn.setOnAction(new EventHandler () public void handle(ActionEvent event) { System.out.println("Hello World!"); } }); StackPane root = new StackPane(); root.getChildren().add(btn); primaryStage.setScene(new Scene(root, 300, 250)); primaryStage.show(); }

Example – Hello World public class JavaFXApplication1 extends Application { /** args the command line arguments */ public static void main(String[] args) { launch(args); public void start(Stage primaryStage) { // Set window's title primaryStage.setTitle("Hello World!"); // Create a button Button btn = new Button(); btn.setText("Say 'Hello World'"); btn.setOnAction(new EventHandler () public void handle(ActionEvent event) { System.out.println("Hello World!"); } }); StackPane root = new StackPane(); root.getChildren().add(btn); primaryStage.setScene(new Scene(root, 300, 250)); primaryStage.show(); }

Example – Hello World public class JavaFXApplication1 extends Application { /** args the command line arguments */ public static void main(String[] args) { launch(args); public void start(Stage primaryStage) { // Set window's title primaryStage.setTitle("Hello World!"); // Create a button Button btn = new Button(); btn.setText("Say 'Hello World'"); btn.setOnAction(new EventHandler () public void handle(ActionEvent event) { System.out.println("Hello World!"); } }); StackPane root = new StackPane(); root.getChildren().add(btn); primaryStage.setScene(new Scene(root, 300, 250)); primaryStage.show(); }

Examples – Forms v1.0 public void start(Stage primaryStage) { // Set Window's Title primaryStage.setTitle("JavaFX Welcome!"); GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); Text scenetitle = new Text("Welcome"); scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20)); grid.add(scenetitle, 0, 0, 2, 1); Label userName = new Label( "User Name:“ ); grid.add(userName, 0, 1); TextField userTextField = new TextField(); grid.add(userTextField, 1, 1); Label pw = new Label("Password:"); grid.add(pw, 0, 2); PasswordField pwBox = new PasswordField(); grid.add(pwBox, 1, 2); Button btn = new Button( "Sign in“ ); HBox hbBtn = new HBox(10); hbBtn.setAlignment(Pos.BOTTOM_RIGHT); hbBtn.getChildren().add(btn); grid.add(hbBtn, 1, 4); final Text actiontarget = new Text(); grid.add(actiontarget, 1, 6); btn.setOnAction( new EventHandler () public void handle(ActionEvent e) { actiontarget.setFill(Color.FIREBRICK); actiontarget.setId( "actiontarget“ ); actiontarget.setText( "Sign in button pressed“ ); } }); Scene scene = new Scene(grid, 300, 275); primaryStage.setScene(scene); primaryStage.show(); }

Examples – Forms v1.0 public void start(Stage primaryStage) { // Set Window's Title primaryStage.setTitle("JavaFX Welcome!"); GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); Text scenetitle = new Text("Welcome"); scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20)); grid.add(scenetitle, 0, 0, 2, 1); Label userName = new Label( "User Name:“ ); grid.add(userName, 0, 1); TextField userTextField = new TextField(); grid.add(userTextField, 1, 1); Label pw = new Label("Password:"); grid.add(pw, 0, 2); PasswordField pwBox = new PasswordField(); grid.add(pwBox, 1, 2); Button btn = new Button( "Sign in“ ); HBox hbBtn = new HBox(10); hbBtn.setAlignment(Pos.BOTTOM_RIGHT); hbBtn.getChildren().add(btn); grid.add(hbBtn, 1, 4); final Text actiontarget = new Text(); grid.add(actiontarget, 1, 6); btn.setOnAction( new EventHandler () public void handle(ActionEvent e) { actiontarget.setFill(Color.FIREBRICK); actiontarget.setId( "actiontarget“ ); actiontarget.setText( "Sign in button pressed“ ); } }); Scene scene = new Scene(grid, 300, 275); primaryStage.setScene(scene); primaryStage.show(); }

Examples – Forms v1.0 public void start(Stage primaryStage) { // Set Window's Title primaryStage.setTitle("JavaFX Welcome!"); GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); Text scenetitle = new Text("Welcome"); scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20)); grid.add(scenetitle, 0, 0, 2, 1); Label userName = new Label( "User Name:“ ); grid.add(userName, 0, 1); TextField userTextField = new TextField(); grid.add(userTextField, 1, 1); Label pw = new Label("Password:"); grid.add(pw, 0, 2); PasswordField pwBox = new PasswordField(); grid.add(pwBox, 1, 2); Button btn = new Button( "Sign in“ ); HBox hbBtn = new HBox(10); hbBtn.setAlignment(Pos.BOTTOM_RIGHT); hbBtn.getChildren().add(btn); grid.add(hbBtn, 1, 4); final Text actiontarget = new Text(); grid.add(actiontarget, 1, 6); btn.setOnAction( new EventHandler () public void handle(ActionEvent e) { actiontarget.setFill(Color.FIREBRICK); actiontarget.setId( "actiontarget“ ); actiontarget.setText( "Sign in button pressed“ ); } }); Scene scene = new Scene(grid, 300, 275); primaryStage.setScene(scene); primaryStage.show(); }

Examples – Forms v1.0 public void start(Stage primaryStage) { // Set Window's Title primaryStage.setTitle("JavaFX Welcome!"); GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); Text scenetitle = new Text("Welcome"); scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20)); grid.add(scenetitle, 0, 0, 2, 1); Label userName = new Label( "User Name:“ ); grid.add(userName, 0, 1); TextField userTextField = new TextField(); grid.add(userTextField, 1, 1); Label pw = new Label("Password:"); grid.add(pw, 0, 2); PasswordField pwBox = new PasswordField(); grid.add(pwBox, 1, 2); Button btn = new Button( "Sign in“ ); HBox hbBtn = new HBox(10); hbBtn.setAlignment(Pos.BOTTOM_RIGHT); hbBtn.getChildren().add(btn); grid.add(hbBtn, 1, 4); final Text actiontarget = new Text(); grid.add(actiontarget, 1, 6); btn.setOnAction( new EventHandler () public void handle(ActionEvent e) { actiontarget.setFill(Color.FIREBRICK); actiontarget.setId( "actiontarget“ ); actiontarget.setText( "Sign in button pressed“ ); } }); Scene scene = new Scene(grid, 300, 275); primaryStage.setScene(scene); primaryStage.show(); }

Examples – Forms v1.0 public void start(Stage primaryStage) { // Set Window's Title primaryStage.setTitle("JavaFX Welcome!"); GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); Text scenetitle = new Text("Welcome"); scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20)); grid.add(scenetitle, 0, 0, 2, 1); Label userName = new Label( "User Name:“ ); grid.add(userName, 0, 1); TextField userTextField = new TextField(); grid.add(userTextField, 1, 1); Label pw = new Label("Password:"); grid.add(pw, 0, 2); PasswordField pwBox = new PasswordField(); grid.add(pwBox, 1, 2); Button btn = new Button( "Sign in“ ); HBox hbBtn = new HBox(10); hbBtn.setAlignment(Pos.BOTTOM_RIGHT); hbBtn.getChildren().add(btn); grid.add(hbBtn, 1, 4); final Text actiontarget = new Text(); grid.add(actiontarget, 1, 6); btn.setOnAction( new EventHandler () public void handle(ActionEvent e) { actiontarget.setFill(Color.FIREBRICK); actiontarget.setId( "actiontarget“ ); actiontarget.setText( "Sign in button pressed“ ); } }); Scene scene = new Scene(grid, 300, 275); primaryStage.setScene(scene); primaryStage.show(); }

Examples – Forms v1.0 public void start(Stage primaryStage) { // Set Window's Title primaryStage.setTitle("JavaFX Welcome!"); GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); Text scenetitle = new Text("Welcome"); scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20)); grid.add(scenetitle, 0, 0, 2, 1); Label userName = new Label( "User Name:“ ); grid.add(userName, 0, 1); TextField userTextField = new TextField(); grid.add(userTextField, 1, 1); Label pw = new Label("Password:"); grid.add(pw, 0, 2); PasswordField pwBox = new PasswordField(); grid.add(pwBox, 1, 2); Button btn = new Button( "Sign in“ ); HBox hbBtn = new HBox(10); hbBtn.setAlignment(Pos.BOTTOM_RIGHT); hbBtn.getChildren().add(btn); grid.add(hbBtn, 1, 4); final Text actiontarget = new Text(); grid.add(actiontarget, 1, 6); btn.setOnAction( new EventHandler () public void handle(ActionEvent e) { actiontarget.setFill(Color.FIREBRICK); actiontarget.setId( "actiontarget“ ); actiontarget.setText( "Sign in button pressed“ ); } }); Scene scene = new Scene(grid, 300, 275); primaryStage.setScene(scene); primaryStage.show(); }

Examples – Forms v2.0b public void start(Stage primaryStage) { // Set Window's Title primaryStage.setTitle( "JavaFX Welcome!“ ); GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER); grid.setHgap(10); grid.setVgap(10); grid.setPadding( new Insets(25, 25, 25, 25)); Text scenetitle = new Text( "Welcome“ ); scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20)); grid.add(scenetitle, 0, 0, 2, 1); Label userName = new Label( "User Name:“ ); grid.add(userName, 0, 1); TextField userTextField = new TextField(); grid.add(userTextField, 1, 1); Label pw = new Label("Password:"); grid.add(pw, 0, 2); PasswordField pwBox = new PasswordField(); grid.add(pwBox, 1, 2); Button btn = new Button( "Sign in“ ); HBox hbBtn = new HBox(10); hbBtn.setAlignment(Pos.BOTTOM_RIGHT); hbBtn.getChildren().add(btn); grid.add(hbBtn, 1, 4); final Text actiontarget = new Text(); grid.add(actiontarget, 1, 6); btn.setOnAction( new EventHandler () public void handle(ActionEvent e) { actiontarget.setFill(Color.FIREBRICK); actiontarget.setId( "actiontarget“ ); actiontarget.setText( "Sign in button pressed“ ); } }); Scene scene = new Scene(grid, 300, 275); primaryStage.setScene(scene); scene.getStylesheets().add(Login.class.getResource("Login.css").toExternalForm()); primaryStage.show(); }

Examples – Forms v2.0b public void start(Stage primaryStage) { // Set Window's Title primaryStage.setTitle( "JavaFX Welcome!“ ); GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER); grid.setHgap(10); grid.setVgap(10); grid.setPadding( new Insets(25, 25, 25, 25)); Text scenetitle = new Text( "Welcome“ ); scenetitle.setId( "welcome-text“ ); grid.add(scenetitle, 0, 0, 2, 1); Label userName = new Label( "User Name:“ ); grid.add(userName, 0, 1); TextField userTextField = new TextField(); grid.add(userTextField, 1, 1); Label pw = new Label("Password:"); grid.add(pw, 0, 2); PasswordField pwBox = new PasswordField(); grid.add(pwBox, 1, 2); Button btn = new Button( "Sign in“ ); HBox hbBtn = new HBox(10); hbBtn.setAlignment(Pos.BOTTOM_RIGHT); hbBtn.getChildren().add(btn); grid.add(hbBtn, 1, 4); final Text actiontarget = new Text(); actiontarget.setId( "welcome-text“ ); grid.add(actiontarget, 1, 6); btn.setOnAction( new EventHandler () public void handle(ActionEvent e) { actiontarget.setId( "actiontarget“ ); actiontarget.setText( "Sign in button pressed“ ); } }); Scene scene = new Scene(grid, 300, 275); primaryStage.setScene(scene); scene.getStylesheets().add( Login.class.getResource( "Login.css“ ).toExternalForm()); primaryStage.show(); }

Examples – Forms v2.0.root { -fx-background-image: url("background.jpg"); }.label { -fx-font-size: 12px; -fx-font-weight: bold; -fx-text-fill: #333333; -fx-effect: dropshadow( gaussian, rgba(255,255,255,0.5), 0,0,0,1 ); } #welcome-text { -fx-font-size: 32px; -fx-font-family: "Arial Black"; -fx-fill: #818181; -fx-effect: innershadow( three-pass-box, rgba(0,0,0,0.7), 6, 0.0, 0, 2 ); } #actiontarget { -fx-fill: FIREBRICK; -fx-font-weight: bold; -fx-effect: dropshadow( gaussian, rgba(255,255,255,0.5), 0,0,0,1 ); }.button { -fx-text-fill: white; -fx-font-family: "Arial Narrow"; -fx-font-weight: bold; -fx-background-color: linear-gradient(#61a2b1, #2A5058); -fx-effect: dropshadow( three-pass-box, rgba(0,0,0,0.6), 5, 0.0, 0, 1 ); }.button:hover { -fx-background-color: linear-gradient(#2A5058, #61a2b1); }

FXML (I) Scriptable, XML-based markup language for defining user interfaces Alternative to developing UI programmatically Easy and intuitive for web developers Allows embedding any JVM scripting language –JavaScript –Groovy –Clojure –…

FXML (II) Controller.java public class Controller { … } FXApplication.java public class FXApplication extends Application { … }

Examples – Forms v3.0 (I) … <GridPane fx:controller="loginfxml.Sample" stylesheets="loginfxml/Login.css" xmlns:fx=" alignment="center" hgap="10" vgap="10"> <Text id="welcome-text" text="Welcome" GridPane.columnIndex="0" GridPane.rowIndex="0" GridPane.columnSpan="2"/>

Examples – Forms v3.0 (II)

Examples – Forms v3.0 (III) … <GridPane fx:controller="loginfxml.Sample“ stylesheets="loginfxml/Login.css" xmlns:fx= alignment="center" hgap="10" vgap="10"> <Text id="welcome-text" text="Welcome" GridPane.columnIndex="0" GridPane.rowIndex="0" GridPane.columnSpan="2"/>

Examples – Forms v3.0 (III) … <GridPane fx:controller="loginfxml.Sample“ stylesheets="loginfxml/Login.css" xmlns:fx= alignment="center" hgap="10" vgap="10"> <Text id="welcome-text" text="Welcome" GridPane.columnIndex="0" GridPane.rowIndex="0" GridPane.columnSpan="2"/>

Examples – Forms v3.0 (III) … <GridPane fx:controller="loginfxml.Sample" stylesheets="loginfxml/Login.css" xmlns:fx=" alignment="center" hgap="10" vgap="10"> <Text id="welcome-text" text="Welcome" GridPane.columnIndex="0" GridPane.rowIndex="0" GridPane.columnSpan="2"/>

Examples – Forms v3.0 (III) … <GridPane fx:controller="loginfxml.Sample" stylesheets="loginfxml/Login.css" xmlns:fx=" alignment="center" hgap="10" vgap="10"> <Text id="welcome-text" text="Welcome" GridPane.columnIndex="0" GridPane.rowIndex="0" GridPane.columnSpan="2"/>

Examples – Forms v3.0 (IV) public class Sample private TextField private PasswordField private Text protected void handleSubmitButtonAction( ActionEvent event ) { if ( passwordField.getText().equals( "Go" ) ) actiontarget.setText( "Signed in as " + usernameField.getText() + "!" ); else actiontarget.setText( "Username or Password not valid" ); }

Examples – Forms v3.0 (IV) public class Sample private TextField private PasswordField private Text protected void handleSubmitButtonAction( ActionEvent event ) { if ( passwordField.getText().equals( "Go" ) ) actiontarget.setText( "Signed in as " + usernameField.getText() + "!" ); else actiontarget.setText( "Username or Password not valid" ); }

Examples – Forms v3.0 (IV) public class Sample private TextField private PasswordField private Text protected void handleSubmitButtonAction( ActionEvent event ) { if ( passwordField.getText().equals( "Go" ) ) actiontarget.setText( "Signed in as " + usernameField.getText() + "!" ); else actiontarget.setText( "Username or Password not valid" ); }

Examples – Forms v3.0 public void start(Stage primaryStage) { Parent root = FXMLLoader.load( getClass().getResource( "Sample.fxml“ ) ); stage.setTitle( "FXML Welcome!" ); stage.setScene( new Scene( root ) ); stage.show(); }

Examples – Forms v3.0 public void start(Stage primaryStage) { Parent root = FXMLLoader.load( getClass().getResource( "Sample.fxml“ ) ); stage.setTitle( "FXML Welcome!" ); stage.setScene( new Scene( root ) ); stage.show(); }

Examples – Forms v3.0 public void start(Stage primaryStage) { Parent root = FXMLLoader.load( getClass().getResource( "Sample.fxml“ ) ); stage.setTitle( "FXML Welcome!" ); stage.setScene( new Scene( root ) ); stage.show(); }

Examples - public void start(Stage primaryStage) { Image iJavaFx = new Image( getClass().getResourceAsStream( "indice.jpg" )); ImageView ivJavaFx = new ImageView(); ivJavaFx.setImage( iJavaFx ); root.getChildren().add( ivJavaFx ); primaryStage.setScene(new Scene(root, 600, 500)); primaryStage.show(); }

Examples - public void start(Stage primaryStage) { Image iJavaFx = new Image( getClass().getResourceAsStream( "indice.jpg" )); ImageView ivJavaFx = new ImageView(); ivJavaFx.setImage(iJavaFx); root.getChildren().add( ivJavaFx ); primaryStage.setScene(new Scene(root, 600, 500)); primaryStage.show(); }

Examples - public void start(Stage primaryStage) { Image iJavaFx = new Image( getClass().getResourceAsStream( "indice.jpg" )); ImageView ivJavaFx = new ImageView(); ivJavaFx.setImage(iJavaFx); root.getChildren().add( ivJavaFx ); primaryStage.setScene(new Scene(root, 600, 500)); primaryStage.show(); }

Examples - public void start(Stage primaryStage) { Image iJavaFx = new Image( getClass().getResourceAsStream( "indice.jpg" )); ImageView ivJavaFx = new ImageView(); root.getChildren().add( ivJavaFx ); primaryStage.setScene(new Scene(root, 600, 500)); primaryStage.show(); }

Examples - public void start(Stage primaryStage) { final String mediaUrl = " 0-2.flv"; // create media player Media media = new Media( mediaUrl ); MediaPlayer mediaPlayer = new MediaPlayer(media); mediaPlayer.setAutoPlay( true ); // create mediaView and add media player to the viewer MediaView mediaView = new MediaView( mediaPlayer ); root.getChildren().add( mediaView ); primaryStage.setScene(new Scene(root, 600, 500)); primaryStage.show(); }

Examples - public void start(Stage primaryStage) { final String mediaUrl = " 0-2.flv"; // create media player Media media = new Media( mediaUrl ); MediaPlayer mediaPlayer = new MediaPlayer(media); mediaPlayer.setAutoPlay( true ); // create mediaView and add media player to the viewer MediaView mediaView = new MediaView( mediaPlayer ); root.getChildren().add( mediaView ); primaryStage.setScene(new Scene(root, 600, 500)); primaryStage.show(); }

Examples - public void start(Stage primaryStage) { final String mediaUrl = " 0-2.flv"; // create media player Media media = new Media( mediaUrl ); MediaPlayer mediaPlayer = new MediaPlayer(media); mediaPlayer.setAutoPlay( true ); // create mediaView and add media player to the viewer MediaView mediaView = new MediaView( mediaPlayer ); root.getChildren().add( mediaView ); primaryStage.setScene(new Scene(root, 600, 500)); primaryStage.show(); }

Examples - public void start(Stage primaryStage) { final String mediaUrl = " 0-2.flv"; // create media player Media media = new Media( mediaUrl ); MediaPlayer mediaPlayer = new MediaPlayer(media); mediaPlayer.setAutoPlay( true ); // create mediaView and add media player to the viewer MediaView mediaView = new MediaView( mediaPlayer ); root.getChildren().add( mediaView ); primaryStage.setScene(new Scene(root, 600, 500)); primaryStage.show(); }

Examples - public void start(Stage primaryStage) { final String mediaUrl = " 0-2.flv"; // create media player Media media = new Media( mediaUrl ); MediaPlayer mediaPlayer = new MediaPlayer(media); mediaPlayer.setAutoPlay( true ); // create mediaView and add media player to the viewer MediaView mediaView = new MediaView( mediaPlayer ); root.getChildren().add( mediaView ); primaryStage.setScene(new Scene(root, 600, 500)); primaryStage.show(); }

Examples - public void start(Stage primaryStage) { WebView webView = new WebView(); webView.getEngine().load( " ); root.getChildren().add( webView ); primaryStage.setScene(new Scene(root, 600, 500)); primaryStage.show(); }

Examples - public void start(Stage primaryStage) { WebView webView = new WebView(); webView.getEngine().load( " ); root.getChildren().add( webView ); primaryStage.setScene(new Scene(root, 600, 500)); primaryStage.show(); }

Examples - public void start(Stage primaryStage) { WebView webView = new WebView(); webView.getEngine().load( " ); root.getChildren().add( webView ); primaryStage.setScene(new Scene(root, 600, 500)); primaryStage.show(); }

Examples - public void start(Stage primaryStage) { WebView webView = new WebView(); webView.getEngine().load( " ); root.getChildren().add( webView ); primaryStage.setScene(new Scene(root, 600, 500)); primaryStage.show(); }

Examples - public void start(Stage primaryStage) { Image iJavaFx = new Image( getClass().getResourceAsStream( "indice.jpg" )); ImageView ivJavaFx = new ImageView(); root.getChildren().add( ivJavaFx ); Reflection r = new Reflection(); r.setFraction( 0.9 ); root.setEffect( r ); primaryStage.setScene(new Scene(root, 600, 500)); primaryStage.show(); }

Examples - public void start(Stage primaryStage) { Image iJavaFx = new Image( getClass().getResourceAsStream( "indice.jpg" )); ImageView ivJavaFx = new ImageView(); root.getChildren().add( ivJavaFx ); Reflection r = new Reflection(); r.setFraction( 0.9 ); root.setEffect( r ); primaryStage.setScene(new Scene(root, 600, 500)); primaryStage.show(); }

Examples - public void start(Stage primaryStage) { Image iJavaFx = new Image( getClass().getResourceAsStream( "indice.jpg" )); ImageView ivJavaFx = new ImageView(); root.getChildren().add( ivJavaFx ); Reflection r = new Reflection(); r.setFraction( 0.9 ); root.setEffect( r ); primaryStage.setScene(new Scene(root, 600, 500)); primaryStage.show(); }

Examples - Transitions final Rectangle rectPath = new Rectangle (0, 0, 40, 40); rectPath.setArcHeight(10); rectPath.setArcWidth(10); rectPath.setFill(Color.ORANGE);... Path path = new Path(); path.getElements().add(new MoveTo(20,20)); path.getElements().add(new CubicCurveTo(380, 0, 380, 120, 200, 120)); path.getElements().add(new CubicCurveTo(0, 120, 0, 240, 380, 240)); PathTransition pathTransition = new PathTransition(); pathTransition.setDuration(Duration.millis(4000)); pathTransition.setPath(path); pathTransition.setNode(rectPath); pathTransition.setOrientation( PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT); pathTransition.setCycleCount(Timeline.INDEFINITE); pathTransition.setAutoReverse(true); pathTransition.play();

Examples - Transitions final Rectangle rectPath = new Rectangle (0, 0, 40, 40); rectPath.setArcHeight(10); rectPath.setArcWidth(10); rectPath.setFill(Color.ORANGE);... Path path = new Path(); path.getElements().add(new MoveTo(20,20)); path.getElements().add(new CubicCurveTo(380, 0, 380, 120, 200, 120)); path.getElements().add(new CubicCurveTo(0, 120, 0, 240, 380, 240)); PathTransition pathTransition = new PathTransition(); pathTransition.setDuration(Duration.millis(4000)); pathTransition.setPath(path); pathTransition.setNode(rectPath); pathTransition.setOrientation( PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT); pathTransition.setCycleCount(Timeline.INDEFINITE); pathTransition.setAutoReverse(true); pathTransition.play();

Examples - Transitions final Rectangle rectPath = new Rectangle (0, 0, 40, 40); rectPath.setArcHeight(10); rectPath.setArcWidth(10); rectPath.setFill(Color.ORANGE);... Path path = new Path(); path.getElements().add(new MoveTo(20,20)); path.getElements().add(new CubicCurveTo(380, 0, 380, 120, 200, 120)); path.getElements().add(new CubicCurveTo(0, 120, 0, 240, 380, 240)); PathTransition pathTransition = new PathTransition(); pathTransition.setDuration(Duration.millis(4000)); pathTransition.setPath(path); pathTransition.setNode(rectPath); pathTransition.setOrientation( PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT); pathTransition.setCycleCount(Timeline.INDEFINITE); pathTransition.setAutoReverse(true); pathTransition.play();

Examples - Transitions final Rectangle rectPath = new Rectangle (0, 0, 40, 40); rectPath.setArcHeight(10); rectPath.setArcWidth(10); rectPath.setFill(Color.ORANGE);... Path path = new Path(); path.getElements().add(new MoveTo(20,20)); path.getElements().add(new CubicCurveTo(380, 0, 380, 120, 200, 120)); path.getElements().add(new CubicCurveTo(0, 120, 0, 240, 380, 240)); PathTransition pathTransition = new PathTransition(); pathTransition.setDuration(Duration.millis(4000)); pathTransition.setPath(path); pathTransition.setNode(rectPath); pathTransition.setOrientation( PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT); pathTransition.setCycleCount(Timeline.INDEFINITE); pathTransition.setAutoReverse(true); pathTransition.play();

Examples - Transitions final Rectangle rectPath = new Rectangle (0, 0, 40, 40); rectPath.setArcHeight(10); rectPath.setArcWidth(10); rectPath.setFill(Color.ORANGE);... Path path = new Path(); path.getElements().add(new MoveTo(20,20)); path.getElements().add(new CubicCurveTo(380, 0, 380, 120, 200, 120)); path.getElements().add(new CubicCurveTo(0, 120, 0, 240, 380, 240)); PathTransition pathTransition = new PathTransition(); pathTransition.setDuration(Duration.millis(4000)); pathTransition.setPath(path); pathTransition.setNode(rectPath); pathTransition.setOrientation( PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT); pathTransition.setCycleCount(Timeline.INDEFINITE); pathTransition.setAutoReverse(true); pathTransition.play();

Deployment

Deployment - Standalone Ideal for offline applications Deploy Jar file

Deployment - Browser Embedded in a web page Can interact with the web page through JavaScript Deploy Jar file, JNLP and HTML

Deployment – Web Start Network

Deployment – Web Start Published on internet Guarantees the latest version Simplify installation and upgrade Deploy Jar file, JNLP and HTML

Conclusions (I) Future for Java Desktop Applications Included in JSE 8 One stop API Pure Java

Conclusions (II) Cross-Platform Deployment on Desktop and/or Web Development & Design

And… now? Download JavaFX SDK and play! Official site JavaFX Documentation Blogs – – –

Спасибо! Benedicto Fernandez Software Engineer CERN / GS-AIS