JavaFX
      overview


Silveira Neto
Sun Campus Ambassador
silveira@sun.com, silveiraneto@gmail.com,        2008 Presenta...
Agenda
                                                  What is JavaFX

                                                 ...
What is JavaFX?
• A family of products
 > JavaFX Framework
    > JavaFX Runtime
    > JavaFX Mobile
    > JavaFX Script
• ...
JavaFX
demos
Introduction: What is Java FX?
“JavaFX  Script  is  a  highly  productive  scripting  language  that 
enables  content  de...
JavaFX Overview
The JavaFX tm Platform is a rich client platform for cross­screen 
  rich internet applications (RIA) and ...
JavaFX Stack
JavaFX Architecture
Scene Graph Project
• Example, javafx.scene.geometry
 > Ellipse          > Polygon
 > Polyline         > Line
 > Arc      ...
Circle
import javafx.scene.geometry.*;
import javafx.scene.paint.*;

Circle {
  centerX: 100
  centerY: 100
  radius: 50
 ...
Rectangle
import javafx.scene.geometry.*;
import javafx.scene.paint.*;

Rectangle {
    x: 50
    y: 50
    width: 200
   ...
Ellipse
import javafx.scene.geometry.*;
import javafx.scene.paint.*;

Ellipse {
    centerX: 50
    centerY: 50
    radius...
ShapeIntersect
import javafx.scene.geometry.*;
import javafx.scene.paint.*;

ShapeIntersect {
    fill: Color.BLACK
    a:...
ShapeSubtract
import javafx.scene.geometry.*;
import javafx.scene.paint.*;

ShapeSubtract {
    fill: Color.BLACK
    a: R...
Animation Framework
• javafx.animation
 >   Interpolatable
 >   Interpolator
 >   KeyFrame
 >   KeyValue
 >   SimpleInterp...
JavaFX Script Language
• Declarative syntax
  >   GUI
  >   Swing
  >   Data binding
  >   Incremental evaluation
• Static...
Script
• A “scriptquot; is one or more declarations or 
  expressions.

  import java.lang.System;

  var ten : Integer = ...
Class
 class Knight {
     attribute health   = 100;
     attribute strength = 10;

     function isDead(){
       return ...
Objects
 var myKnight = Knight {}

 var megaKnight = Knight {
       health: 150;
     strength: 15;
 }

 myKnight.hurt(me...
Basic Data Types
  JavaFX    Default value        Java
String     “”               java.lang.String
Boolean    false      ...
String Examples
 var   s1   =   quot;Javaquot;;
 var   s2   =   quot;FXquot;;
 var   s3   =   quot;Java{s2}quot;; // s3 = ...
Boolean Examples
 var cool = true;
 var s = quot;Java{if(cool)quot;FXquot;elsequot;Scriptquot;}quot;;
 //s = quot;JavaFXqu...
Duration Examples
var   t1   =   5ms;   //   5 milliseconds
var   t2   =   10s;   //   10 seconds
var   t3   =   30m;   //...
Sequences Examples
var x = [1,2,3];
// array initialization

insert 10 into x;
// [1, 2, 3, 10]

insert 12 before x[1];
//...
JavaFX Command Line Interface
• Compiling
 > javafxc script.fx
• Running
 > javafx script
JavaFX Tools
•   Project Nile
•   NetBeans IDE JavaFX Plug­in
•   Your favorite IDE + JavaFX CLI
•   Inkscape
    > Coming...
Java FX Resources
• Java FX Project Site: http://openjfx.dev.java.net
  > Java.net: Download early versions of Java FX
  >...
Java FX Resources (more)
• Sun's Java FX Site:
  > http://www.sun.com/software/javafx/
  > http://www.javafx.com
  > Sun M...
JavaFX Books
• JavaFX Script: Dynamic Java Scripting for 
  Rich Internet/Client­side Application, by 
  James L. Weaver, ...
References
•   Balloons photo from first and last slides by Jesus Solana
    >  http://flickr.com/photos/pasotraspaso/1408...
Open Source University Meetup
• OSUM
  >   http://osum.sun.com
  >   http://osum.sun.com/group/ufc/
  >   http://osum.sun....
Java FX   • Download Java FX & IDE 
            Plugins for Netbeans or 
What to     Eclipse
Do        • Join OpenJFX Java...
Thank you!
Silveira Neto
Sun Campus Ambassador
mail: silveira@sun.com
IM/mail: silveiraneto@gmail.com
                    ...
Upcoming SlideShare
Loading in...5
×

JavaFX Overview

6,852

Published on

Short overview on JavaFX basic concepts.

Published in: Technology, News & Politics
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
6,852
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
714
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

JavaFX Overview

  1. 1. JavaFX overview Silveira Neto Sun Campus Ambassador silveira@sun.com, silveiraneto@gmail.com, 2008 Presentation at CEJUG event silveiraneto.net Café com Tapioca at Christus University
  2. 2. Agenda What is JavaFX Demos JavaFX Framework JavaFX Script Where To Go Fireworks photo by Darrell Taylor at http://flickr.com/photos/d4rr3ll/300075196/
  3. 3. What is JavaFX? • A family of products > JavaFX Framework > JavaFX Runtime > JavaFX Mobile > JavaFX Script • Who > Developers > Designers • What > RIA
  4. 4. JavaFX demos
  5. 5. Introduction: What is Java FX? “JavaFX  Script  is  a  highly  productive  scripting  language  that  enables  content  developers  to  create  rich  media  and  content  for  deployment  on  Java  environments.  JavaFX  Script  is  a  declarative, statically­typed programming language. It has first­ class  functions,  declarative  syntax,  list­comprehensions,  and  incremental dependency­based evaluation. It can make direct  calls to Java APIs that are on the platform.” ­­https://openjfx.dev.java.net/
  6. 6. JavaFX Overview The JavaFX tm Platform is a rich client platform for cross­screen  rich internet applications (RIA) and content. It consists of  common elements (2D graphics, Animation, Text and Media)  and device specific elements for desktop, mobile and TV. The  JavaFX common set of APIs allow source level portability of  the common set of functionalities across all platforms  supported by JavaFX. The JavaFX Runtimes targeted for  different devices will ensure consistency and fidelity for  content created based on the JavaFX Common APIs. The  JavaFX Common APIs will continue to evolve to match more  powerful, common capabilities on the various device types.
  7. 7. JavaFX Stack
  8. 8. JavaFX Architecture
  9. 9. Scene Graph Project • Example, javafx.scene.geometry > Ellipse > Polygon > Polyline > Line > Arc > Circle > Path > ArcTo > ShapeSubtract > PathElement > QuadCurve > HlineTo > DelegateShape > VlineTo > ClosePath > CurveTo > CubicCurve > QuadTo > Shape > ShapeIntersect > LineTo > MoveTo > SVGPath > Rectangle
  10. 10. Circle import javafx.scene.geometry.*; import javafx.scene.paint.*; Circle { centerX: 100 centerY: 100 radius: 50 fill: Color.BLACK }
  11. 11. Rectangle import javafx.scene.geometry.*; import javafx.scene.paint.*; Rectangle { x: 50 y: 50 width: 200 height: 100 arcWidth: 20 arcHeight: 20 fill: Color.BLACK }
  12. 12. Ellipse import javafx.scene.geometry.*; import javafx.scene.paint.*; Ellipse { centerX: 50 centerY: 50 radiusX: 50 radiusY: 25 fill: Color.BLACK }
  13. 13. ShapeIntersect import javafx.scene.geometry.*; import javafx.scene.paint.*; ShapeIntersect { fill: Color.BLACK a: Rectangle { width: 100 height: 50 } b: Ellipse { centerX: 100 centerY: 25 radiusX: 50 radiusY: 25 } }
  14. 14. ShapeSubtract import javafx.scene.geometry.*; import javafx.scene.paint.*; ShapeSubtract { fill: Color.BLACK a: Rectangle { width: 100 height: 50 } b: Ellipse { centerX: 100 centerY: 25 radiusX: 50 radiusY: 25 } }
  15. 15. Animation Framework • javafx.animation > Interpolatable > Interpolator > KeyFrame > KeyValue > SimpleInterpolator > Timeline
  16. 16. JavaFX Script Language • Declarative syntax > GUI > Swing > Data binding > Incremental evaluation • Statically typed > and code structuring, reuse, and  encapsulation features that enable creating  and maintaining very large programs in the  Java programming language.
  17. 17. Script • A “scriptquot; is one or more declarations or  expressions. import java.lang.System; var ten : Integer = 10; var s = quot;Twice {ten} is {2 * ten}.quot;); // s == “Twice 10 is 20”. • No main, classes or functions are mandatory.
  18. 18. Class class Knight { attribute health = 100; attribute strength = 10; function isDead(){ return health > 0 } function hurt(amount: Integer){ health -= amount } }
  19. 19. Objects var myKnight = Knight {} var megaKnight = Knight { health: 150; strength: 15; } myKnight.hurt(megaKnight.strength); // myKight.health = 85
  20. 20. Basic Data Types JavaFX Default value Java String “” java.lang.String Boolean false java.lang.Boolean Number 0 java.lang.Number Integer 0.0 byte, short, int, long, BigInteger Duration N/A N/A
  21. 21. String Examples var s1 = quot;Javaquot;; var s2 = quot;FXquot;; var s3 = quot;Java{s2}quot;; // s3 = 'Hello Joe' var s4 = quot;{s1}{s2}quot;; // s4 = quot;JavaFXquot;
  22. 22. Boolean Examples var cool = true; var s = quot;Java{if(cool)quot;FXquot;elsequot;Scriptquot;}quot;; //s = quot;JavaFXquot; var a = true; // a = true var b = false; // b = false var c = a and b; // c = false var d = a or b; // d = true var e = not a; // e = false
  23. 23. Duration Examples var t1 = 5ms; // 5 milliseconds var t2 = 10s; // 10 seconds var t3 = 30m; // 30 minutes var t4 = 1h; // 1 hour var t5 = t1 + t2 + t3 + t4; // 1 hour 30 min 10 secs and 5 millisecs
  24. 24. Sequences Examples var x = [1,2,3]; // array initialization insert 10 into x; // [1, 2, 3, 10] insert 12 before x[1]; // [1, 12, 2, 3, 10] delete 12 from x; // [1, 2, 3, 10] insert [1..10] into x; // [1, 2, 3, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  25. 25. JavaFX Command Line Interface • Compiling > javafxc script.fx • Running > javafx script
  26. 26. JavaFX Tools • Project Nile • NetBeans IDE JavaFX Plug­in • Your favorite IDE + JavaFX CLI • Inkscape > Coming soon (next version) > File → Save As → JavaFx
  27. 27. Java FX Resources • Java FX Project Site: http://openjfx.dev.java.net > Java.net: Download early versions of Java FX > IDE Plugins, Tutorials, Forums, FAQs > “Getting Started With the JavaFX Script Language” > “JavaFX Script 2D Graphics Tutorial” > “The JavaFX Script Programming Language Reference” • Planet FX Wiki: http://jfx.wikia.com/wiki/Main_Page > Open­source documentation site for Java FX • James Weaver's Blog > Best blog about JavaFX > http://learnjavafx.typepad.com/
  28. 28. Java FX Resources (more) • Sun's Java FX Site: > http://www.sun.com/software/javafx/ > http://www.javafx.com > Sun Microsystems official product page • Chris Oliver's Blog: http://blogs.sun.com/chrisoliver/ > Latest news, other informal information > Source code for lots of demos (Space Invaders, Calculator) • My blog :­) > http://silveiraneto.net
  29. 29. JavaFX Books • JavaFX Script: Dynamic Java Scripting for  Rich Internet/Client­side Application, by  James L. Weaver, published by Apress. • Dynamische und interaktive Java­ Applikationen mit JavaFX, by Ralph  Steyer, published by Addison­Wesley. • はじめての JavaFX― 最新スクリトプト言 語の基礎を徹底解説 ! by  清水美樹 ,  published by  工学社 .
  30. 30. References • Balloons photo from first and last slides by Jesus Solana >  http://flickr.com/photos/pasotraspaso/1408057351/ • Fireworks photo at agenda by Darrell Taylor >  http://flickr.com/photos/d4rr3ll/300075196/ • Lots of JavaOne 2008 JavaFX's Presentations > http://developers.sun.com/learning/javaoneonline/ • JavaFx Preview 1 API > http://javafx.com/releases/preview1/docs/api/ • Javafx.com Videos > http://www.javafx.com • My Youtube JavaFX Channel > http://br.youtube.com/user/NetoSilveira • JavaFX NetBeans Plugin > http://javafx.netbeans.org/
  31. 31. Open Source University Meetup • OSUM > http://osum.sun.com > http://osum.sun.com/group/ufc/ > http://osum.sun.com/group/fchristus > http://osum.sun.com/group/fa7 > http://osum.sun.com/group/cefetce > http://osum.sun.com/group/uva > http://osum.sun.com/group/javafx • Enter and create your own
  32. 32. Java FX • Download Java FX & IDE  Plugins for Netbeans or  What to Eclipse Do • Join OpenJFX Java.net  Project • Do Java FX Tutorials • Participate on Java FX  Forums • Create something cool! http://openjfx.dev.java.net
  33. 33. Thank you! Silveira Neto Sun Campus Ambassador mail: silveira@sun.com IM/mail: silveiraneto@gmail.com Some rights reserved blog: http://silveiraneto.net download these slides at silveiraneto.net
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×