Spring Motion - Physics in JavaFX

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 !


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 :)

Posted by Aditya on December 10, 2008 at 07:54 AM IST #

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

Posted by Vaibhav Choudhary on December 10, 2008 at 07:57 AM IST #

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

Posted by Prakash on December 11, 2008 at 08:57 AM IST #

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.

Posted by Vaibhav on December 11, 2008 at 09:11 AM IST #

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?

Posted by Cedric on December 22, 2008 at 10:44 AM IST #

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 !

Posted by Vaibhav on December 22, 2008 at 11:16 AM IST #

Thank you very much for your fast reactivity and for your blog \^\^
James L. Weaver recommand to use [projectName]Main.fx ;-)

Posted by Cedric on December 23, 2008 at 07:03 AM IST #

Thank you Kate !

Posted by Vaibhav on January 05, 2009 at 05:35 AM IST #

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)

Posted by Jim Weaver on February 05, 2009 at 01:17 PM IST #

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.

Posted by Vaibhav on February 05, 2009 at 04:40 PM IST #


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.

Posted by Arun on August 21, 2009 at 10:06 AM IST #


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.

Posted by Arun on August 28, 2009 at 09:56 AM IST #

thank you !

I guess netbeans generate mobile compatible file.

Posted by Vaibhav Choudhary on August 31, 2009 at 07:46 AM IST #

Interesting thing!
This is my first time comment at your blog.
Good recommended website.

Posted by z.l.q on February 23, 2010 at 02:44 AM IST #

Post a Comment:
  • HTML Syntax: NOT allowed

Vaibhav Hi, I am Vaibhav Choudhary working in Oracle with JDK team. This blog is all about simple concept of Java, JVM and JavaFX.


« February 2016