Yet another blog about WPF, Surface, SL, MVVM, NUI....





Tag - Netbeans

Entries feed - Comments feed


You could use the JavaFX Media Component.... Yes but where is it ?

8 December 2008

Have you been trying all the wonderful demo on on the JavaFX web site ? Yes ? Me too !

You can try the "Simple Video Player" for example :

Simple Video Player sample

It's great but when I tried to reproduce the video player i meet a little problem.

It tells "You could use the JavaFX Media Component, a prefabricated video player in the com.sun.fxmediacomponent package."... But where is it ? I Just cannot find it on the web...

You then have two solutions:

  1. Download the source code and use the jar file present in the lib folder,
  2. Reproduce this package by your own implementations...

I really prefere the second solutions and I will make a little How-To in a future posts to tell you how to do...



Deploy a JavaFX app as an applet with the Java Deployement Toolkit... (Updated twice)

Yesterday I tried to write my first JavaFX... I Found it quite easy.... It's name was "VideoPlayer".

But when I tried to put it on a web page and deploy it as an java Applet it became a Nightmare !

First I tried to use the code Netbeans give me in my 'dist' folder... It worked well on my computer but not when I putted it on my web site...

I notice then that it was trying to load the JNLP from this host: "http://localhost:8093/servlet/org.netbeans.modules.javafx.project.JnlpDownloadServlet/"... It was the problem !

So I change my "VideoPlayer_browser.jnlp" and change the host by the one of my webSite : "". It then look like this :

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="" href="VideoPlayer_browser.jnlp">
        <vendor>Jonathan ANTOINE</vendor>
        <homepage href=""/>
        <j2se version="1.5+"/>
        <extension name="JavaFX Runtime" href=""/>
        <jar href="VideoPlayer.jar" main="true"/>
    <applet-desc name="VideoPlayer" main-class="com.sun.javafx.runtime.adapter.Applet" width="384" height="288">
        <param name="MainJavaFXScript" value="videoplayer.Main">

It then worked well !

I also give you what to put in your HTML page :

              archive: "VideoPlayer.jar",
              draggable: true,
              width: 384,
              height: 306,
              code: "fr.antoinej.videoplayer.Main",
              name: "VideoPlayer"
	      isApplet: true

I some params (isApplet: true) to tell my apps that it is an applet....

An other interesting thing you can add on you HTML page is to add thie next snippet in the header part. It will reload you JNLP files and do not use the cache each time you will load the page... Better when adding frequently features to you application...


Update (21/12/2008): You can now find a tutorials on the JavaFx webSite : here !