JavaFX: The preview has landed

Written by on July 31st, 2008 in Uncategorized.

JavaFX was announced at JavaOne…. in 2007, and we are now seeing a preview release.

Josh Marinacci of the JavaFX team put together a post with an example that builds the following:

The code for this is simply:

JAVA:

  1.  
  2. package blogdemo;
  3.  
  4. import javafx.scene.*;
  5. import javafx.scene.paint.*;
  6. import javafx.scene.geometry.*;
  7. import javafx.application.*;
  8. import javafx.scene.transform.*;
  9. import javafx.input.*;
  10. import javafx.animation.*;
  11. import java.lang.System;
  12.  
  13. var angle = 0.0;
  14.  
  15.     windowStyle: WindowStyle.TRANSPARENT  visible: true
  16.     width: 400 height: 400
  17.     stage: Stage {
  18.         fill: null
  19.         content: Group {
  20.             translateX: 100 translateY: 100
  21.             content: for(i in [0..10]) {
  22.                 // here is the magic with binding
  23.                 Rectangle {
  24.                     fill: Color.rgb(25*i,0,0, i/10.0)
  25.                     width: 100 height: 100 arcHeight: 10 arcWidth: 10
  26.                     stroke: Color.BLACK strokeWidth: 5
  27.                     transform: bind [
  28.                         Transform.rotate(-i*36+angle/2,50,50),
  29.                         Transform.translate(angle/4,0),
  30.                     ]
  31.                 }
  32.             }
  33.             onMousePressed: function(e:MouseEvent):Void { System.exit(0); }
  34.         }
  35.     }
  36. }
  37.  
  38. var anim = Timeline { keyFrames: [
  39.         KeyFrame { time: 0s values: angle => -360 tween Interpolator.EASEBOTH },
  40.         KeyFrame { time: 2s values: angle => 360 tween Interpolator.EASEBOTH },
  41.     ]
  42.     autoReverse: true
  43.     repeatCount: Timeline.INDEFINITE
  44. };
  45. anim.start();
  46.  

And you can check out the application if you have Java 1.6 installed.

Michael Coté got together with the Sun folks and recorded a demo and interview:

I am interested to see what Sun does with JavaFX, but I have to admit to being underwhelmed and more excited about what Sun could do with the Java plugin and have that as a way to interact with Ajax applications.

Source: Ajaxian » Front Page
Original Article: http://feeds.feedburner.com/~r/ajaxian/~3/351660309/javafx-the-preview-has-landed

Comments are closed.



Site Navigation