Java Reference
In-Depth Information
Listing 9.17
JavaFX - Accessing Instance Variables via Script Variables
public var myInstance : MyApplet;
public class MyApplet {
...
}
function run(args: String[] ) : Void {
myInstance = MyApplet{};
}
JavaScript can then access the instance via the myInstance script variable. For
example, the JavaScript code could be
var theAppletInstance = document.app.myInstance ;
This JavaScript variable, AppletInstance , could then be used to access the
instance variables and functions contained in the JavaFX MyApplet class.
Java Web Start
Java Web Start is a technology that allows you to start a networked application
from an HTML Web page or directly from the desktop. This is an alternative way
to distribute your applications without having to go through a specific install pro-
cess. The first time you launch a Java Web Start application, all the necessary
files are downloaded off the network and cached locally on your computer. If
there are updates, Java Web Start automatically pulls down the updated files. As
a result, you do not have to worry about distributing updates to your customers.
When they run the application, the Java Web Start will make sure they have the
most up-to-date version.
The applet framework we just covered is based on Java Web Start, so there will
be a lot of commonality between the two. The first step is to create your applica-
tion, test it, then create signed JAR files for the application. These steps are the
same as those we covered in the section for JavaFX applets. For creating signed
JAR files, see the section under Java Applets, Manual Generation, Signed Jars.
Of course, if you build your distribution with NetBeans IDE for JavaFX, the IDE
does this automatically for you.
The next step is to create a Java Network Launch Protocol (JNLP) deployment file.
This is similar to the way we created a JNLP file for JavaFX Applets that we dis-
cussed previously in the Deploying a JavaFX Application as an Applet section of this
chapter. However, there is a difference in one area. Instead of having an <applet-
desc> section under the <jnlp> tag, there is an <application-desc> section.
 
 
Search WWH ::




Custom Search