Below is a simple test JavaFX applet that confirms that JavaFx applets can indeed run within a drupal page. I'm hesitant to admit that I had more difficulty with this than I should have -- it is fairly easy to get wrong and difficult to figure out why it doesn't work.
Here is my approach:
-
Download Vaibhav Choudhar's example analog clock from http://javafx.com/samples/AnalogClock/index.html
-
Unzip the Netbeans example into a folder
-
Startup Netbeans, open the "Analog Clock" project and bring up the project properties. Set the Run category to "Run in Browser"
-
Clean and Build the "Analog Project"
-
Create a new drupal page or story and set the input format for the page to "Full Html" or "Php". This is so the markup will be rendered and not filtered out.
-
Go to the drupal root directory and create a new folder under "default/site/files" (I called mine "javafx")
-
Upload the files "AnalogClock.jar", "AnalogClock.jnlp", and "AnalogClock_browser" to the new "sites/default/files/javafx" directory
-
Copy everything within the "<script>" tags in the file"AnalogClock.html" (located in the Netbeans AnalogClock dist folder) to the new drupal page.
-
Change the archive tag from archive:"AnalogClock.jar" to archive:"/sites/default/files/javafx/AnalogClock.jar"
-
Change the jnlp pages "homepage" element to be some URL of your website rather than localhost (info only).
-
For the applet to run on the webpage the codebase in the AnalogClock_browser.jnlp must be correct. In this case it should be "/sites/default/files/javafx/"
-
For the application to run in webstart, the codebase in the AnalogClock.jnlp must also be correct.
Problems in items 11 and 12 are difficult to spot as the files are locally cached so you need to be sure that you have the current version. To clear the cache open the "Java Control Panel" (in Vista its available in the tray at the lower right of your screen when a java applet is running). Push the "View" button at the bottom of the "Java Control Panel" in the "Temporary Internet Files" section. The files currently being cached are displayed. Select the application by clicking on its name and then "right click" on it to pull up a menu to remove it.
Here is the markup for the analog clock below:
<script src="http://dl.javafx.com/1.2/dtfx.js"></script><script>
javafx(
{
archive: "/sites/default/files/javafx/AnalogClock.jar",
draggable: true,
width: 240,
height: 320,
code: "analogclock.Main",
name: "AnalogClock"
}
);
</script>
Comments
Hello I have a question
Hello I have a question .....
Arrrr
What 's your Drupal version to use this JAVAFX code
Drupal 6.x or 7.x