Vaibhav's Blog Space

  • Java
    December 10, 2008

Spring Motion - Physics in JavaFX

Guest Author

3 weeks back, we were thinking of some cool application to make. I am a guy who has seen very less outside world, so coming up with some great idea is always tough for me. So, deciding that, I went back to my tenth class physics book and saw some of the cool physics motion. Its one of the tough subject and always screw me in exam. Searching some of the easy equation, I though to make one spring motion. Meantime, I though there is some spring motion residing in our repository. Actually one of the Josh applications do it in awesome way, but still we were missing the actual feel of Spring motion because of the gig-gag and spiral stuff attached to the wall and spring is going up and down in it, with a complete view of awesomeness :). This is what finally we achieve from this blog :

 I can still bet this can be 3 times much better than what you are seeing here. So, little of good news here that this sample can be executed on mobile

Here are the code files :

1. Main file.

2. Spring file.

3. SpringEquation file.

Enjoy FX'ing !

Join the discussion

Comments ( 15 )
  • Aditya Wednesday, December 10, 2008

    i must say another interesting article on java fx...

    the spring example is a good one,

    may be you could write a physics package for the rest of us, it would make for really easy FX'ing :)

  • Vaibhav Choudhary Wednesday, December 10, 2008

    Thanks Aditya. Actually its ready. But lets post it one by one :D. Easy to get, easy to write :)

  • Prakash Thursday, December 11, 2008

    Nice app...how can I play this inside browser? I am using FF3 on Mac.

  • Vaibhav Thursday, December 11, 2008

    Thanks Prakash. Deploy it like applet, just as you do with Java code :). JavaFX files also get converted into class files.

    Let us know if still you are getting any problem.

  • Cedric Monday, December 22, 2008

    The link to the main file points to the main from the house and stars example. Is it possible to have the right main file?

  • Vaibhav Monday, December 22, 2008

    Thanks Cedric for pointing this out. This is a nice lesson for me, I should not use Main.fx all the time. It has been replaced with the latest blog of Main.fx. Now I have changed it again.

    Sorry for the problem !

  • Cedric Tuesday, December 23, 2008

    Thank you very much for your fast reactivity and for your blog \^\^

    James L. Weaver recommand to use [projectName]Main.fx ;-)

  • Vaibhav Monday, January 5, 2009

    Thank you Kate !

  • Jim Weaver Thursday, February 5, 2009


    Can you please remove the lines in the JNLP that cause the shortcut dialog box to be displayed? I'm going to feature this post on the JavaFXpert blog, and would like to avoid the extra click.

    Nice examples!

    Jim Weaver

    http://JavaFXpert.com (Learn JavaFX Blog)

  • Vaibhav Thursday, February 5, 2009

    Thanks Jim. I have changed the mobile image here as well because the gradient bug is fixed now :). And added the JNLP link here as well without saying for Desktop Shortcut. I hope this is working fine.

  • Arun Friday, August 21, 2009


    Thanks for the nice samples.

    I'm a beginner to javaFX and can you post a simple example with code of Integrating the existing MIDlet with the javaFx.

  • Arun Friday, August 28, 2009


    Can you please provide a sample code fro integrating existing midlet and one of your javafx samples.

    Please im a beginner in this.. and ur blog seemed so helpful.

  • Vaibhav Choudhary Monday, August 31, 2009

    thank you !

    I guess netbeans generate mobile compatible file.

  • Tag Heuer watches Sunday, December 20, 2009
  • z.l.q Monday, February 22, 2010

    Interesting thing!

    This is my first time comment at your blog.

    Good recommended website.

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.