« Slides from JavaPolis 2007 JavaFX Script in Action "University Session" | Main | Spotting JavaFX Apps in the Wild - Santa's Super Status System »

December 23, 2007


Jim Weaver

Today applets cannot subclass javafx.ui.Applet, which they should (just like Swing applets should subclass JApplet). This should be fixed soon, and I'll make a post as soon as that happens. It's probably just a side effect from how compiled JavaFX Script maps classes which use multiple inheritance to Java single inheritance, and should be fixed soon.

Eric Love

Hello Jim,
I can't wait until your blog comes out concerning JavaFX Applets. Also, thanks for providing information on JavaFX Apps deployment using JNLP in your blog. Great and very useful information.

Jim Weaver


Thanks for your kind words about my book. A member of the JavaFX Script Compiler team worked over the Christmas holiday on a simple, elegant, way to create JavaFX Applets. This effort is almost finished, and as soon as it is, I'll blog about it. In the meantime, as I promised, here is the code that I used to create this example. Please remember that it uses compiled JavaFX Script, and that it shouldn't be used as a basis for creating JavaFX Applets other than just playing around. A more elegant solution is coming soon.

// AppletStub.java
package jfxapplet;
import javax.swing.JApplet;
public class AppletStub extends JApplet { }

* HappyHolidaysAppletJFX.fx - A Compiled JavaFX Script applet example
* Developed 2007 by James L. Weaver (jim.weaver at lat-inc dot com)
* to serve as a JavaFX Script example. This particular example shows
* a technique for dislaying applets that will be improved upon by the
* JavaFX compiler team, but it works for now.
package jfxapplet;
import javafx.ui.*;
import javafx.ui.canvas.*;
import java.lang.System;
import jfxapplet.AppletStub;
public class HappyHolidaysAppletJFX extends AppletStub {
public function >():Void {
var message:String = "Happy Holidays";
var messageOpa:Integer = 0;
var panel =
BorderPanel {
TitledBorder {
title: "Happy Holidays JavaFX Applet"
FlowPanel {
content: [
Button {
text: "Happy Holidays"
function() {
messageOpa = if (messageOpa == 0) 1 else 0;
Canvas {
Group {
content: [
ImageView {
Image {
url: "https://duke.dev.java.net/images/misc/SantaDuke.png"
opacity: bind 1 - messageOpa * .2
Text {
Font {
faceName: "Palace Script MT"
style: FontStyle.PLAIN
size: 80
stroke: Color.RED
fill: Color.RED
x: 60
y: 300
content: bind message
opacity: bind messageOpa

// HappyHolidaysAppletPage.html

Eric Love

I just got your book on JavaFX Script. It is great. I was wondering if JFX can be used to create applets. Fom your blog, I guess it can be done. I would like to your code JFX Applet.



The comments to this entry are closed.