The Source for Java Technology Collaboration
User: Password:



Richard Bair's Blog

Richard Bair Richard is a longtime speaker and member of the Swing Team at Sun Microsystems. He has his roots as an application developer turned toolkit developer and is the lead of the component toolkit API for JavaFX. He is a frequent presenter and teams up frequently with other UI luminaries to produce demos for JavaOne and other conferences. As an application developer he had a specific penchant for databases and multi-tier design,



Keep your FX Code Clean (My version)

Posted by rbair on March 24, 2009 at 11:54 AM | Permalink | Comments (1)

The Exploding Pixels blog has an entry on clean FX code formatting. I didn't really like the options provided so far, so I decided to write a quick blog with my version.
def backgroundImage = Image { url: "{__DIR__}background.png" };
var verticalPositionOfLine:Number;

var s = Stage {
    title: "Background Image"
    scene: Scene {
        width: 200
        height: 232
        content: [
            ImageView { image: backgroundImage },
            // Paints two moving lines
            Group {
                translateY: bind verticalPositionOfLine
                content: [
                    Line { startX:0, startY:20, endX:200, endY:0, stroke:Color.RED }
                    Line { startX:0, startY:30, endX:200, endY:10, stroke:Color.RED }
                ]
            }
        ]
    }
}

// Start the line animation
Timeline {
    repeatCount: Timeline.INDEFINITE
    keyFrames: [
      at (0s) { verticalPositionOfLine => -20 }
      at (3s) { verticalPositionOfLine => 200 tween Interpolator.LINEAR }
    }
}.play();
s


May 2009
Sun Mon Tue Wed Thu Fri Sat
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            


Search this blog:
  

Categories
Community: JavaDesktop
J2SE
Swing
Archives

March 2009
November 2008
November 2007
October 2007
May 2007
January 2007
October 2006
August 2006
July 2006
June 2006
May 2006
February 2006
October 2005
August 2005

Recent Entries

Keep your FX Code Clean (My version)

Java(FX) Enterprise Development

Leaving For Dublin

Articles

Web Swinging
You application needs content from a web page or web service, so that rules out writing a rich application and forces you to write a web app, right? Not so fast. The emerging trend of smashups--Swing mashups--combine rich Swing GUIs with data fetched from the Web. Richard Bair shows you how to bring these web-fetching techniques to your Swing app. Oct. 12, 2006

All articles by Richard Bair »



Powered by
Movable Type 3.01D


 Feed java.net RSS Feeds