Vaibhav's Blog Space

  • Java
    January 8, 2009

JavaFX - Samples + Usages.

Guest Author

Ah, finally I got JNLP working on my blog, thanks to Sergey and Vikram. I am posting some of my samples with JNLP as we can use as repository for JavaFX samples :). These all are old samples but just with JNLP, so that we can run and see the effect. 

1. Spring Motion : We can create n no. of instance of Spring class. Detail is here. This example deals with Motion, Gradient and Physics Equations.

2. 3D Button Effect:  This example is about PressButton and 3D shadow effect. Detail is here. Basic deals with Shadow Effect, Gradient, and Animation.

3. Glowing Stars in Sky: This example I have created with JavaFX Production Suite. So, we made a home in Photoshop and imported that in JavaFX and then star animation is written in JavaFX. Detail is here. This sample deals with JavaFX Production Suite, Animation, Timelines and Shapes.

4. Colliding Balls: This we have blogged some 4-5 days back. This is again a physics motion with a transparent window. Detail is here. Sample deals with Motion, Equation, Timelines and Gradient. Initial positions and colors are random, so can be wired at sometime + style: StageStyle.TRANSPARENT has been used, so we will not see any frame and so close button will be missing, please press Ctrl + F4 to close the application :). I guess, the good practice is to write esc. key event and call FX.exit().

5. Image Depth support in JavaFX:  Image depth setting or in some language we call it Z-Ordering is supported in JavaFX too. Last to last blog is about that, so here is detail. This sample basically deals with toFront and toBack API of Node and Animation(nothing cool in terms of Animation :D). 

6. Pendulum Motion with Gravity Controller: This is just the last blog. Detail is here. This sample deals with Motion, Gradient and Complex Equations, Binding Feature. I have changed the code little from the prev. blog. Now, it is transparent, so it will give us a better look :)

Feel free to share your experience. I hope all JNLP should work, if not please let me know. Some more I will add soon, actually all these are older samples, just tried to make repoistory, so that easy to find :).

Join the discussion

Comments ( 23 )
  • Angad Singh Tuesday, January 13, 2009

    Finally! Great work!

  • Thierry Wednesday, January 14, 2009

    All the jnlp work fine for me.

    Really nice job.

    I would rank it 20/20 if there was not this !!#@??!! Warning messages...

  • Vaibhav Wednesday, January 14, 2009

    thanks Angad, thanks Thierry.

    ya, this should work else it was fake !

  • Chris Gerhard Tuesday, February 3, 2009

    Alas they don't work for me on OpenSolaris:

    java.net.MalformedURLException: unknown protocol: socket

    at java.net.URL.<init>(URL.java:574)

    at java.net.URL.<init>(URL.java:464)

    at java.net.URL.<init>(URL.java:413)

    at java.net.URI.toURL(URI.java:1081)

    at com.sun.deploy.net.proxy.DeployProxySelector.connectFailed(DeployProxySelector.java:204)

    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)

    at java.net.Socket.connect(Socket.java:519)

    at java.net.Socket.connect(Socket.java:469)

    at sun.net.NetworkClient.doConnect(NetworkClient.java:163)

    at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)

    at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)

    at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)

    at sun.net.www.http.HttpClient.New(HttpClient.java:306)

    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:844)

    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:792)

    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:703)

    at com.sun.deploy.net.BasicHttpRequest.doRequest(BasicHttpRequest.java:185)

    at com.sun.deploy.net.BasicHttpRequest.doGetRequestEX(BasicHttpRequest.java:63)

    at com.sun.deploy.net.DownloadEngine.actionDownload(DownloadEngine.java:1098)

    at com.sun.deploy.net.DownloadEngine.getCacheEntry(DownloadEngine.java:1456)

    at com.sun.deploy.net.DownloadEngine.getCacheEntry(DownloadEngine.java:1434)

    at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(DownloadEngine.java:1537)

    at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(DownloadEngine.java:1465)

    at com.sun.deploy.net.DownloadEngine.getResource(DownloadEngine.java:211)

    at com.sun.deploy.net.DownloadEngine.getResource(DownloadEngine.java:195)

    at com.sun.javaws.Launcher.updateFinalLaunchDesc(Launcher.java:297)

    at com.sun.javaws.Launcher.prepareToLaunch(Launcher.java:167)

    at com.sun.javaws.Launcher.launch(Launcher.java:111)

    at com.sun.javaws.Main.launchApp(Main.java:315)

    at com.sun.javaws.Main.continueInSecureThread(Main.java:219)

    at com.sun.javaws.Main$1.run(Main.java:107)

    at java.lang.Thread.run(Thread.java:619)

  • Vaibhav Choudhary Tuesday, February 3, 2009

    Oh bad, any other JNLP works for you .. on any site. Or Solaris has problem with all JNLP's of JavaFX. Like try out this :


    If so, we need to fig. out the problem.

  • Chris Gerhard Tuesday, February 3, 2009
  • Vaibhav Choudhary Tuesday, February 3, 2009

    Alright, I will check out this problem. If somewhere bug has been raised or we will raise one :)

  • Silveira Neto Tuesday, February 3, 2009

    I tried all examples and all worked properly here. ;D

  • Vaibhav Choudhary Tuesday, February 3, 2009

    nice ! you are also running on Solaris ?

    Actually this java.net.MalformedURLException error was there on my windows machine as well but I never digged down the reason.

  • rajashree Monday, February 9, 2009

    Can you help me in making a media player with FX in an optimized way.Thank you.

  • Vaibhav Monday, February 9, 2009

    Sure, what are the features you are looking.

    You can see some of the MP3 player or video players here on sample site :


  • Vaibhav Thursday, February 26, 2009

    this is cool, everything works fine with me.

  • zammbi Monday, April 6, 2009

    Solaris and Linux isn't supported by JavaFx yet.

  • Vaibhav Choudhary Sunday, May 3, 2009

    Sorry, soon it will be :)

  • Mark Smith Thursday, July 30, 2009

    One of my favorite things about your blog is your use of specific examples to illustrate your point. I am feeling great to visit your blog. You sure have put lots of effort into this site.


    Mark Smith


  • Vaibhav Choudhary Thursday, July 30, 2009

    Thank you Mark !

    Nice to see health insurance techy reading JavaFX blogs :)

  • Andrew Jacob Thursday, July 30, 2009

    Hello everyone,

    I really appreciate the effort into this article. I have very much valued the tools of blogging and twitter and slowly learning all the many hints and tips that I am very grateful for. All 6 points are nice and very informative for me.

    I have 3 sites which may be helpful for visitors:





    Andrew Jacob

  • Tag Heuer watches Sunday, December 20, 2009
  • China Wholesale Friday, January 8, 2010

    This is great news. Best of luck for the future and keep up the good work.

  • klaussner furniture Friday, January 22, 2010

    I have enjoyed reading, I will make sure and bookmark this page and be back to follow you.

  • Matt Klein Monday, June 14, 2010

    Hello Vaibhav

    I am a physics teacher in London and I am trying to learn JFX to make animations for my lessons. I am came across your "Insertion trigger in JavaFX" and "Motion of Ball Under Gravity - JavaFX" posts earlier in your blog. In both of these you kindly presented code, which I tried to use. However, I am unable to get the code to work in Netbeans. For example, lots of the import statements (import javafx.scene.geometry.\*; or import javafx.application.Frame;) do not exist.

    I could write such an application in Processing or Flash quite easily (without the use of classes) but I am specifically now trying to learn JFX and how to use classes. Therefore your examples, if they work, will be perfect for me to try and learn. I noticed that the blog posts are very old, so maybe this is why I cannot get them to work.

    Do you have these applications in newer code? Or maybe you could update your code for everybody to try and learn from?

    As somebody who is struggling with JFX your help would me much appreciated!

    Thank you

    Matt Klein

  • Daniel Sourcing Monday, September 27, 2010

    Java FX is great!

  • sudeep Tuesday, September 28, 2010

    i am trying to build a video/audio recorder cum player and i had designed the frame in JavaFx and to link it with java as core engine

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