JavaFX Presentation For SJUG

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Favorite

    JavaFX Presentation For SJUG - Presentation Transcript

    1. JavaFX The future of Rich Client Java Presented to Sydney Java Users Group 8 October 2009 By Steven Herod steven@herod.net http://twitter.com/sherod (Available for JavaFX work :) Friday, 9 October 2009 1
    2. Who am I? • Steven Herod • CTO, Development Manager, Project Manager, Architect, Developer, Frequent Tweeter Friday, 9 October 2009 2
    3. What have I done with JavaFX? • Working with JavaFX since a few days after 1.0 release • Built ‘TwitterFX’, a fully featured* Twitter Client. • TwitterFX was a launch application in Sun’s Java Store (annouced at 2009 Java One) • Worked with Pre release 1.2 version under NDA • Informally in touch with Sun’s internal team Friday, 9 October 2009 3
    4. TwitterFX Version 2.0 Version 3.0 (in dev) Friday, 9 October 2009 4
    5. What is JavaFX? • It’s a programming language • JavaFX Script • It’s a runtime • On top of the JRE • It’s a common approach to rich applications on your Desktop, Mobile and TV Set • The API is divided in to 4 profiles: Common, Mobile, Desktop and TV Friday, 9 October 2009 5
    6. What is it not • It’s not a server side programming language • I haven’t heard the slighted rumour of this being the case. Friday, 9 October 2009 6
    7. JavaFX Script • It’s not a script • Your app is compiled by ‘javafxc’ to Java bytecode and shipped as a JAR. • It’s intended to be friendly to ‘the designer types’ Friday, 9 October 2009 7
    8. What’s special about JavaFX? • Declarative syntax • Baked in data binding • Function types/Closures • Mixin inheritance • Video / Audio support • Built in codec for Flash Video/MP3 • Fall back to Java* Friday, 9 October 2009 8
    9. • Can launch via WebStart or Applet • And you can drag applet out of browser window to install them. • Runs on Java 1.6 • Dev on Windows, Mac, Linux, Solaris, • Run on Windows, Mac, Linux, Solaris, Friday, 9 October 2009 9
    10. Communication capabilities • RESTful Web services with a parser for XML and JSON. • Higher level support for ATOM and RSS feeds. • Supports streaming video for media player • Go look at net for formats supported Friday, 9 October 2009 10
    11. Supported controls • All are native JavaFX controls (written in JavaFX) • You can wrap Swing controls • Supported native controls: Button, CheckBox, Hyperlink, Label, ListView, ProgressBar, ProgressIndicator, RadioButton, ScrollBar, Slider, TextBox, TextInputControl, ToggleButton, by Sergey Malenkov Friday, 9 October 2009 11
    12. Charts AreaChart, BarChart, BarChart3D, BubbleChart, LineChart, PieChart, PieChart3D, ScatterChart, XYChart, by Dean Iverson Friday, 9 October 2009 12
    13. You may go ‘oooooh’ if you want to. Friday, 9 October 2009 13
    14. “Hello World” Friday, 9 October 2009 14
    15. Hello World package helloworld; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.text.Text; import javafx.scene.text.Font; /** * @author steven */ Stage { title: "Hello SJUG!" width: 250 height: 80 scene: Scene { content: [ Text { font : Font { size : 16 } x: 10 y: 30 content: "Hello World" } ] } } Friday, 9 October 2009 15
    16. THERE IS NO public static main(args String[]){} THERE IS ONLY Stage {} Friday, 9 October 2009 16
    17. Huh? Friday, 9 October 2009 17
    18. It’s all about the Scene Graph Friday, 9 October 2009 18
    19. “Whats a Scene Graph” • “The scene graph is a structure that arranges the logical and often (but not necessarily) spatial representation of a graphical scene. The definition of a scene graph is fuzzy because programmers who implement scene graphs in applications and in particular the games industry take the basic principles and adapt these to suit particular applications. This means there is no consensus as to what a scene graph should be.” Friday, 9 October 2009 19
    20. “Thanks Wikipedia” Friday, 9 October 2009 20
    21. Think of a tree Or if you are sick and twisted, an XML document (Don’t panic, you write NO XML in a JavaFX program) Friday, 9 October 2009 21
    22. “All the worlds a Stage...” • All the action takes place ‘On the Stage’ • There is a root element (the ‘Scene’) • Everything else visual is a type of ‘Node’ • ‘Text’, ‘Group’, ‘VBox’, ‘Panel’, ‘Stack’,‘Rectangle’ ‘Button’ ‘MediaPlayer’ • Some nodes can contain other nodes, until you have a hierarchy, or a tree or Friday, 9 October 2009 22
    23. “Scene Graph” Friday, 9 October 2009 23
    24. JavaFX Syntax Friday, 9 October 2009 24
    25. An ‘easier’ Java It takes a couple of hours to pick up Friday, 9 October 2009 25
    26. def vs var • Variables which are defined once, and are never assigned-to, are defined with def. • def myDef = 3 • def myDef = bind otherVar • Variables that will or can be assigned-to should be declared with var: • var myVar = 3 Friday, 9 October 2009 26
    27. Iteration for (x in [1..3]) { println(“The current value of x is P{indexof x}”); } Friday, 9 October 2009 27
    28. Boring How about... Friday, 9 October 2009 28
    29. var squares : Integer[] = for (x in [1..10]) x*x; Yes, our for loop evaluates to an array* of all the squares between 1..10 (thats [ 1, 4, 9, 16, 25, 36, 49, 64, 81, 100 ) Friday, 9 October 2009 29
    30. I lied (You noticed the *)? It’s not an Array, its a Sequence Friday, 9 October 2009 30
    31. Sequences • A JavaFX Script sequence represents an ordered list of data of the same type. • Sequences are immutable • You can do lots of cool things with a Sequence Friday, 9 October 2009 31
    32. • Declaring one • var booleans:Boolean[] = [true, false] • Interpolate • var nums = [1..10] • The for loop example used a sequence in the for(x in [1..10) • var nums = [1..10 step 2] • Populates nums with 1,3,5,7,9 • Obtain slices • println( mySequence[3..] ); • Create sequences of functions • var functions = function(myString:String)[]; Friday, 9 October 2009 32
    33. “and in the darkness bind them” Friday, 9 October 2009 33
    34. Type of binding • Simple bind • var myVar = bind someOtherVar • Inverse bind • var myVar = bind otherVar with inverse Friday, 9 October 2009 34
    35. • conditional binding • def x = bind if (condExpr) expr1 else expr2; • bind to a sequence • def values = bind for (x in [min..max]) square(x); • bind to a function • def value = bind myFunc(x,y) • bound functions • bound function bob(x,y) { x*y*z } Friday, 9 October 2009 35
    36. Impact of binds • All bind updates happen on the EDT • So, binding may be quick, but the scenegraph may not be.... • bound values use more memory than non bound values Friday, 9 October 2009 36
    37. “on replace” var bob:String on replace oldBob { if (oldBob == "chicken" and bob == "cow") then otherVar = "{oldBob}{bob}"; } • on replace fires on initialisation as well as update • You can do this for sequences to with some funky stuff, but I haven’t figured it out yet. Friday, 9 October 2009 37
    38. Creating a class var myStaticVar; public class myClass { public-read var myReadOnlyVar; public-init var myInitOnceVar; public var myGoCrazy; var myPrivateVar; } Friday, 9 October 2009 38
    39. Inheritence • JavaFX 1.0 - 1.1 had multiple inheritance • But I don’t think it worked • Java 1.2 drops that and introduces mixin classes • mixin class MyMixin { } • You can extend any number of Mixins, but you can’t directly instantiate one. • class myClass extends MyMixin1, MyMixin2 {} Friday, 9 October 2009 39
    40. Other bits • Duration is a first class type: • def myTime = 2h * 0.6h • Localization is baked in • def about = ##[JOKE]"Michael Neale sucks"; • Methods or member vars that override a parents definition must use the keyword ‘override’ • override function myFunc(); Friday, 9 October 2009 40
    41. Tooling Friday, 9 October 2009 41
    42. It’s early days • SDK, Netbeans & JavaFX 1.2 Production Suite (Officially Supported) • Eclipse (Sun backed, open source) • Exadel JavaFX Studio Friday, 9 October 2009 42
    43. Unit Testing Friday, 9 October 2009 43
    44. “We’ve had some success using junit internally” Friday, 9 October 2009 44
    45. Functional Testing Friday, 9 October 2009 45
    46. Although some work is being done in FEST Friday, 9 October 2009 46
    47. The future Friday, 9 October 2009 47
    48. What’s next? • Java FX 1.3 “SoMa”, which will focus on: • Making binding dirt cheap • Making object creation & insertion dirt cheap • Removing eager binding from the scenegraph • by making things lazy, it means we only have to compute once per frame in many cases rather than constantly • Reducing the memory cost of Node • Reducing the number of Nodes created • In particular, making it so that CustomNode's can deal with more than one item so you don't have to have useless wrapping groups all the time Friday, 9 October 2009 48
    49. What else? • A new graphics stack • Out with Java2d/AWT/Swing • Immediate mode Java 2d • In with ‘PRISM’ • Direct to Hardware Acceleration • But will it be enabled by default? Friday, 9 October 2009 49
    50. Other tooling • JavaFX Authoring Tool • Being worked on by Tor Norbye of JavaPosse fame. Friday, 9 October 2009 50
    51. When is SoMa? • December? January? February? • Nothing announced yet Friday, 9 October 2009 51
    52. Want to know more? http://bit.ly/sjugoctober Questions? Friday, 9 October 2009 52
    SlideShare Zeitgeist 2009

    + Steven HerodSteven Herod Nominate

    custom

    945 views, 1 favs, 2 embeds more stats

    My presentation to Sydney Java Users Group about th more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 945
      • 594 on SlideShare
      • 351 from embeds
    • Comments 0
    • Favorites 1
    • Downloads 15
    Most viewed embeds
    • 290 views on http://javafree.uol.com.br
    • 61 views on http://blogs.herod.net

    more

    All embeds
    • 290 views on http://javafree.uol.com.br
    • 61 views on http://blogs.herod.net

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories