Learning JavaFX? Join me..

JavaFX has been creating lot of buzz since JavaOne'2007 and I could not overcome the temptation to try it out myself and see how it brings down the complexity of developing Rich UI contents. I have been into the Quality side of Java2D/AWT area for quite sometime and my goal is to see how easy it is to develop some cool 2D graphics and animations in FX.  I am pretty much impressed with my first interaction with JavaFX.

I am still in the process of learning JavaFX and my Java knowledge hampers the learning process a bit. That's because JavaFX offers the flexibility of writing Java code and calling Java programs from within the FX script and I often tend to misuse that flexibility even in the places where FX offers much more easier ways of doing things than Java (primarily due to the declarative syntax for the UI). Due to this fact, I am getting more cautious now when I am about to write something in Java inside the FX script.

Nevertheless, it is good to share whatever I have developed so far -

PingPong

I had this game written in Java and I just wanted to port it to JavaFX. It was pretty easy in fact and I was able to do it in a few hours (That's actually good considering that I am just a newbie with FX syntax and semantics). But pardon me for some Java code that I have put in the script and I will be migrating them to FX as I climb up the FX ladder.

FX PingPong screenshot

 

I have used the Swing Timer class to do the animations to start with. I was really excited about the simplicity with which I can move the ball/bat, just by changing the x,y property and binding takes care of updating the UI.

Just try it yourself (You would need jdk6+. It might take a couple of minutes to load, the first time) -


Here is the script -

pingpong.fx

I am in the processing of writing few other apps in the 2D/Swing area and I swear it will have more FX stuff than Java. Stay Tuned !!

Comments:

A good start!

Posted by Rajender Tella on August 07, 2007 at 08:08 PM IST #

Nice app praveen.

Posted by Bala Kondepudi on September 04, 2007 at 08:42 AM IST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

mohanpraveen

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
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
   
       
Today