Deprecated: Assigning the return value of new by reference is deprecated in /home/w3hja33/public_html/wp-includes/cache.php on line 99

Deprecated: Assigning the return value of new by reference is deprecated in /home/w3hja33/public_html/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /home/w3hja33/public_html/wp-includes/theme.php on line 576
Jnlp | w3hJava

w3hJava

What, Why, When and How of Java, JavaFX and related technologies


Published January 14th, 2009

JavaFX Samples in JNLP Style

In my last blog, I have added jnlp files of JavaFX samples. These are the simple steps how to do it with the help of netbeans.

Step 1: Compile the Project after this change(here my project name is Carousel) :

Project -> Properties - > Run -> Web Start Execution.

Step 2: It will generate some files :
- Project.jar
- Project.jnlp
- Project_Browser.jnlp.
- Project.html

Step 3: Open jnlp file in editpad, and you need to do some changes:

Here it will look originally:

<?xml version="1.0" encoding="UTF-8"?>

 <jnlp spec="1.0+" codebase="http://localhost:8082/servlet/

 org.netbeans.modules.javafx.project.JnlpDownloadServlet/D%3A/

 NetBeansProjects/Carousel/dist/” href=”Carousel.jnlp”>

     <information>

         <title>Carousel</title>

         <vendor>Vaibhav Choudhary</vendor>

         <homepage href=”http://localhost:8082/servlet/

 org.netbeans.modules.javafx.project.JnlpDownloadServlet/D%3A/

 NetBeansProjects/Carousel/dist/”/>

         <description>Carousel</description>

         <offline-allowed/>

         <shortcut>

             <desktop/>

         </shortcut>

     </information>

     <security>

         <all-permissions/>

     </security>

     <resources>

         <j2se version=”1.5+”/>

         <property name=”jnlp.packEnabled” value=”true”/>

         <property name=”jnlp.versionEnabled” value=”true”/>

         <extension name=”JavaFX Runtime” href=”http://dl.javafx.com/

 javafx-rt.jnlp”/>

         <jar href=”Carousel.jar” main=”true”/>

     </resources>

     <application-desc main-class=”carousel.Main”/>

 </jnlp>

Step 4: You need to change: CodeBase with what is required(means where you
uploaded the file, you need to upload jar file and jnlp(modified
file). In my case it is : http://blogs.sun.com/vaibhav/resources/.
this is where we upload file in Sun blog

Step 5: So, after change :

<?xml version="1.0" encoding="UTF-8"?>

 <jnlp spec="1.0+" codebase="http://blogs.sun.com/vaibhav/resources/”

 href=”Carousel.jnlp”>

     <information>

         <title>Carousel</title>

         <vendor>Vaibhav Choudhary</vendor>

         <homepage href=”http://blogs.sun.com/vaibhav/“/>

         <description>Carousel</description>

         <offline-allowed/>

         <shortcut>

             <desktop/>

         </shortcut>

     </information>

     <security>

         <all-permissions/>

     </security>

     <resources>

         <j2se version=”1.5+”/>

         <property name=”jnlp.packEnabled” value=”true”/>

         <property name=”jnlp.versionEnabled” value=”true”/>

         <extension name=”JavaFX Runtime” href=”http://dl.javafx.com/

 javafx-rt.jnlp”/>

         <jar href=”Carousel.jar” main=”true”/>

     </resources>

     <application-desc main-class=”carousel.Main”/>

 </jnlp>

Step 6: Look at the href: http://dl.javafx.com/javafx-rt.jnlp, this will take
care of the responsible jar or jnlp files which is required by JavaFX
Runtime. Just a word of caution, look at your lib folder as well,
which will be there in your dist directory along with jnlp and jar
files. If it has something, then upload that as well in lib/files(most
of the time it will be empty). But if you have used Java Production
Suite, there will be files like javafx-fxd.jar files :).

Step 7: In blog now just add a line(in html) :

<p style="width: 500px;"><a href="blogs.sun.com/vaibhav/resource/

 Carousel.jnlp"><img border="0" src="http://java.sun.com/products/jfc/

 tsc/sightings/images/webstart.small.jpg” /></a></p>

That’s it !

Published January 9th, 2009

JavaFX Sample Repo + Usages !

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