Asking Experts Transcript
If you are interested by the Java's RIA part check out this link: http://java.sun.com/developer/community/askxprt/sessions/2008/jl0818.jsp
Deezer clone - 1st step
Well, I think that to have a well defined goal is always a nice start. I can stay focus on it and my reflections keep together in the good direction.
If as me you prefer sometimes to have a preview of the result before read the next, just click on the launch button!
Draw the rectangle
So to start I had to draw a simple rectangle; quite easy with JavaFx:Rectangle{
width: 120
height: 100
fill: Color.BLACK;
}
LinearGradient{
startX: 0.0
startY: 0.0
endX: 0.0
endY: 1.0
stops : [
Stop{offset: 0.0 color: Color.rgb(163,163,163)},
Stop{offset: 0.5 color: Color.rgb(106,106,106)},
Stop{offset: 0.51 color: Color.rgb(43,43,43)},
Stop{offset: 1.0 color: Color.rgb(57,57,57)}
]
}
This code can now replace the Color.BLACK in our previous rectangle's code. Actually we have the rectangle with the right color. After having done the same thing to have the rectangle with blue tints, we just have to start the animating stuff. Before going on I'd like to precise that the 2nd rectangle is located at the same location than the 1st rectangle but with an opacitiy value of 0. We will only change the opacity to create the fading animation.
Fade animation
Have you already developed a Swing application? If so, did you ever try to add animation stuff to it? I don't know about you, but to me it has always been a nightmare. The good news are that with JavaFX, a new era is here!For my demo, I have been really keen about the JavaFX abilities, here is the code to get a fade animation on our rectangle:
Timeline{
keyframes:[time: 0.6s values: op => 1.0 tween Interpolator.LINEAR]
}
JavaFX Custom node
The last thing to do is drawing the text of the menu item. Once again, quite easy:Text{
label: "HOME"
x: 0
y: 0
fill: Color.ORANGE
}
That's it for the 1st step. We have seen how to create a JavaFX custom node that is reusable. But there are still serveral steps from the final deezer's clone... Watch out!
[The code source is avaible under BSD license.]
What are the plans
I like beautiful apps and I admire guys who are able to build ones. I follow developers like Romain Guy and Chet Haase who are often associated as speakers of the well known (at least in the Java world) Filthy Rich Clients conference and authors of the same titled book. If you haven't taken a look at their work don't hesitate, it's really worth looking!
One day, I'd like to build beautiful application as theirs. I'm really not as talented as them, so it will be hard. However, I hope that with commitment and work I will tend to good results. I read a lot about all technologies available to build so called rich applications and we have some contenders in the landscape: Silverlight, Flex/Air and JavaFX.
As you may know, I come from Java world. So, to start I will try to improve my skills with JavaFX that has been recently released as a Preview SDK. I'll begin with an easy demo: deezer's menu clone.
![]()
With this job I should learn:
- Layout management of JavaFX
- Paint system, for the different gradients
- A bit of animation stuff (see on the site: fade in/out)
All this stuff is done as part of my spare time so it may take some time to be done ;).
P.S. : all corrections about my English grammar/vocabulary are welcome - drop me an email, or just write a comment, thanks a lot

