« Previous day (Feb 18, 2009) | Main | Next day (Feb 20, 2009) »
 20090219 Thursday February 19, 2009

Converting iPhone to JavaFX Mobile

Yep, I'm finding using the newly launched JavaFX Mobile to be a lot of fun. Here's an example of taking the iPhone GUI and converting it to JavaFX Mobile. Try out the JavaFX Mobile app in this blog post. You should see it start up to the left. Try clicking on one of the icons to see the iPhone icons bouncing.


It is pretty cool to see how easy it is to program in JavaFX Script. The code is tight and easy to understand.


The ramp-up to learning JavaFX Script (from knowing Java ME MIDP programming) is not too bad.


It's nice to see the new innovations in Java ME and JavaFX technologies...

*NOTE: On initial launch, you may see 2 dialog boxes. Accept both: "This applet was signed by 'JavaFX...'" Click: "Trust". "JavaFX delivers rich media and content..." Click: "Accept".


Partial source code:

var camImage = ImageView {
    translateX: bind width * .77
    translateY: bind bounceAnimY;
    image: Image { url: "{__DIR__}image/iphone-cam.png"
    }
    onMousePressed: function(e:MouseEvent) {
        bounceAnim.time = 0s;
        bounceAnim.play();
    }
    onMouseEntered: function(me:MouseEvent) {
        bounceButton.selected = true;

    }
    onMouseExited: function(me:MouseEvent) {
        bounceButton.selected = false;
    }
};


// this function is called to reinitialize the values when the height changes
function createAnims() {
    springAnimY = height - 100;
    springAnim = Timeline {
        keyFrames: [
           at(1s) { springAnimY => 50 }
           at(2.5s) { springAnimY => 
            height - 100.0 tween spring}
        ]
    };
    bounceAnimY = height - 100;
    bounceAnim = Timeline {
        keyFrames: [
            at(1s) { bounceAnimY => 50 }
            at(2.5s) { bounceAnimY => 
            height - 100.0 tween bounce}
        ]
    };
}

[Java ME and J2ME] ( February 19, 2009 07:03 PM ) Permalink





Theme originally based on design by Bryan Bell