Download presentation
Presentation is loading. Please wait.
2
Va installato Qui le istruzioni https:// www.eclipse.org/efxclipse/install.htm
3
Contents What is JavaFX? History What’s new in JavaFX 2.X? Architecture What’s coming next? Examples Deployment
4
What is JavaFX? (I)
5
What is JavaFX? (II) Rich sets of graphics and media API Cross-Platform Deploy on the Desktop or in the browser
6
What can I build with JavaFX?
8
History 20072008 2009 2010 JavaOne Announce JavaFX JavaFX 1.0 JavaOne End of JavaFX Script 2011 2012 JavaOne JavaFX 2.0
9
JavaFX Roadmap 20112012 2013 2014 JavaFX 2.0 Windows GA Mac OS X Dev. Preview JavaFX 2.0 Scene Builder EA JavaFX 2.0.2 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
10
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
11
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
12
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
13
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
14
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
15
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
16
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
17
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
18
Examples
19
Example – Hello World public class JavaFXApplication1 extends Application { /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } @Override 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 () { @Override 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(); }
20
Example – Hello World public class JavaFXApplication1 extends Application { /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } @Override 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 () { @Override 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(); }
21
Example – Hello World public class JavaFXApplication1 extends Application { /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } @Override 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 () { @Override 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(); }
22
Example – Hello World public class JavaFXApplication1 extends Application { /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } @Override 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 () { @Override 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(); }
23
Example – Hello World public class JavaFXApplication1 extends Application { /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } @Override 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 () { @Override 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(); }
24
Example – Hello World public class JavaFXApplication1 extends Application { /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } @Override 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 () { @Override 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(); }
25
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 () { @Override 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(); }
26
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 () { @Override 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(); }
27
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 () { @Override 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(); }
28
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 () { @Override 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(); }
29
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 () { @Override 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(); }
30
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 () { @Override 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(); }
31
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 –…
32
FXML (II) Controller.java public class Controller { … } FXApplication.java public class FXApplication extends Application { … }
33
Examples – Forms v3.0 (I) … <GridPane fx:controller="loginfxml.Sample" stylesheets="loginfxml/Login.css" xmlns:fx="http://javafx.com/fxml" alignment="center" hgap="10" vgap="10"> <Text id="welcome-text" text="Welcome" GridPane.columnIndex="0" GridPane.rowIndex="0" GridPane.columnSpan="2"/>
34
Examples – Forms v3.0 (II)
35
Examples – Forms v3.0 (III) … <GridPane fx:controller="loginfxml.Sample“ stylesheets="loginfxml/Login.css" xmlns:fx=http://javafx.com/fxmlhttp://javafx.com/fxml alignment="center" hgap="10" vgap="10"> <Text id="welcome-text" text="Welcome" GridPane.columnIndex="0" GridPane.rowIndex="0" GridPane.columnSpan="2"/>
36
Examples – Forms v3.0 (III) … <GridPane fx:controller="loginfxml.Sample“ stylesheets="loginfxml/Login.css" xmlns:fx=http://javafx.com/fxmlhttp://javafx.com/fxml alignment="center" hgap="10" vgap="10"> <Text id="welcome-text" text="Welcome" GridPane.columnIndex="0" GridPane.rowIndex="0" GridPane.columnSpan="2"/>
37
Examples – Forms v3.0 (III) … <GridPane fx:controller="loginfxml.Sample" stylesheets="loginfxml/Login.css" xmlns:fx="http://javafx.com/fxml" alignment="center" hgap="10" vgap="10"> <Text id="welcome-text" text="Welcome" GridPane.columnIndex="0" GridPane.rowIndex="0" GridPane.columnSpan="2"/>
38
Examples – Forms v3.0 (III) … <GridPane fx:controller="loginfxml.Sample" stylesheets="loginfxml/Login.css" xmlns:fx="http://javafx.com/fxml" alignment="center" hgap="10" vgap="10"> <Text id="welcome-text" text="Welcome" GridPane.columnIndex="0" GridPane.rowIndex="0" GridPane.columnSpan="2"/>
39
Examples – Forms v3.0 (IV) public class Sample { @FXML private TextField usernameField; @FXML private PasswordField passwordField; @FXML private Text actiontarget; @FXML 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" ); }
40
Examples – Forms v3.0 (IV) public class Sample { @FXML private TextField usernameField; @FXML private PasswordField passwordField; @FXML private Text actiontarget; @FXML 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" ); }
41
Examples – Forms v3.0 (IV) public class Sample { @FXML private TextField usernameField; @FXML private PasswordField passwordField; @FXML private Text actiontarget; @FXML 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" ); }
42
Examples – Forms v3.0 (V) @Override public void start(Stage primaryStage) { Parent root = FXMLLoader.load( getClass().getResource( "Sample.fxml“ ) ); stage.setTitle( "FXML Welcome!" ); stage.setScene( new Scene( root ) ); stage.show(); }
43
Examples – Forms v3.0 (V) @Override public void start(Stage primaryStage) { Parent root = FXMLLoader.load( getClass().getResource( "Sample.fxml“ ) ); stage.setTitle( "FXML Welcome!" ); stage.setScene( new Scene( root ) ); stage.show(); }
44
Examples – Forms v3.0 (V) @Override public void start(Stage primaryStage) { Parent root = FXMLLoader.load( getClass().getResource( "Sample.fxml“ ) ); stage.setTitle( "FXML Welcome!" ); stage.setScene( new Scene( root ) ); stage.show(); }
45
Examples - Images @Override 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(); }
46
Examples - Images @Override 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(); }
47
Examples - Images @Override 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(); }
48
Examples - Images @Override 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(); }
49
Examples - Media @Override public void start(Stage primaryStage) { final String mediaUrl = "http://download.oracle.com/otndocs/products/javafx/oow201 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(); }
50
Examples - Media @Override public void start(Stage primaryStage) { final String mediaUrl = "http://download.oracle.com/otndocs/products/javafx/oow201 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(); }
51
Examples - Media @Override public void start(Stage primaryStage) { final String mediaUrl = "http://download.oracle.com/otndocs/products/javafx/oow201 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(); }
52
Examples - Media @Override public void start(Stage primaryStage) { final String mediaUrl = "http://download.oracle.com/otndocs/products/javafx/oow201 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(); }
53
Examples - Media @Override public void start(Stage primaryStage) { final String mediaUrl = "http://download.oracle.com/otndocs/products/javafx/oow201 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(); }
54
Examples - Web @Override public void start(Stage primaryStage) { WebView webView = new WebView(); webView.getEngine().load( "http://javafx.com" ); root.getChildren().add( webView ); primaryStage.setScene(new Scene(root, 600, 500)); primaryStage.show(); }
55
Examples - Web @Override public void start(Stage primaryStage) { WebView webView = new WebView(); webView.getEngine().load( "http://javafx.com" ); root.getChildren().add( webView ); primaryStage.setScene(new Scene(root, 600, 500)); primaryStage.show(); }
56
Examples - Web @Override public void start(Stage primaryStage) { WebView webView = new WebView(); webView.getEngine().load( "http://javafx.com" ); root.getChildren().add( webView ); primaryStage.setScene(new Scene(root, 600, 500)); primaryStage.show(); }
57
Examples - Web @Override public void start(Stage primaryStage) { WebView webView = new WebView(); webView.getEngine().load( "http://javafx.com" ); root.getChildren().add( webView ); primaryStage.setScene(new Scene(root, 600, 500)); primaryStage.show(); }
58
Examples - Effects @Override 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(); }
59
Examples - Effects @Override 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(); }
60
Examples - Effects @Override 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(); }
61
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();
62
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();
63
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();
64
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();
65
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();
66
ColorfulCircles
69
Deployment
70
Deployment - Standalone Ideal for offline applications Deploy Jar file
71
Deployment - Browser Embedded in a web page Can interact with the web page through JavaScript Deploy Jar file, JNLP and HTML
72
Deployment – Web Start Network
73
Deployment – Web Start Published on internet Guarantees the latest version Simplify installation and upgrade Deploy Jar file, JNLP and HTML
74
Conclusions (I) Future for Java Desktop Applications Included in JSE 8 One stop API Pure Java
75
Conclusions (II) Cross-Platform Deployment on Desktop and/or Web Development & Design
76
And… now? Download JavaFX SDK and play! Official site http://javafx.comhttp://javafx.com JavaFX Documentation http://docs.oracle.com/javafx/ http://docs.oracle.com/javafx/ Blogs –https://blogs.oracle.com/javafx/https://blogs.oracle.com/javafx/ –http://fxexperience.comhttp://fxexperience.com –http://www.learnjavafx.typepad.com/weblog/http://www.learnjavafx.typepad.com/weblog/
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.