Converting iPhone to JavaFX Mobile

<script src="http://dl.javafx.com/1.1/dtfx.js"></script> <script> var u10only = ''; var webstartAllowed = ''; if(u10only=='true' && !deployJava.isPlugin2()) { document.write("

"); document.write("This sample needs Java SE 6 Update 10 or higher with Internet Explorer 7+ or FireFox 3+"); document.write(""); document.write("

"); } else { javafx( { codebase: "http://blogs.sun.com/hinkmond/resource/classes", archive: "SpringAnimation.jar", width: 176, height: 220, code: "custominterpolator.SpringDemo", name: "appl" } ); } </script>
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}
        ]
    };
}

Comments:

Post a Comment:
Comments are closed for this entry.
About

Hinkmond Wong's blog on making the Internet of Things (IoT) smarter with Java Technologies

Search

Archives
« April 2015
SunMonTueWedThuFriSat
   
1
3
4
5
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  
       
Today