Java Reference
In-Depth Information
-appCodebase "http://my.server/path/to/app/"
-appWidth 200 -appHeight 75
2. Lastly, deploy draggable-applet.jar , draggable-applet_browser.jnlp ,
and draggable-applet.html files on a web server at the location specified
by the -codeBase flag in the javafxpackager command line.
Now, notice when the applet is accessed from a browser that it looks as expected.
It is unaltered with no indication that it is draggable, as shown in the next screenshot:
However, when you attempt to drag the applet you are able to move it outside of its original
docked location in the page. You can drag the applet outside of the browser unto the desktop,
as shown in the next screenshot:
How it works...
Drag-to-install is another nice feature, found in the redesigned Java Plugin architecture (made
available as of version 1.6u10). It provides users with the ability to drag applets from their
embedded location in the browser directly onto the desktop. Let's see how this is done:
F The JavaFX code —the application presented here is purely illustrative. It is a simple
digital clock that displays the current time. Notice, however, that the Stage literal
declaration includes a value for the property extensions:StageExtension[] .
The StageExtension class is designed as an extension point for classes that
provide profile-specific functionalities.
For this recipe, we use the AppletStageExtension class which provides
integration support between browser-embedded applets and the JavaFX application
Stage. Specifically, the AppletStageExtension is used here to define the behavior
of the applet through callback functions when it is dragged off the browser page. The
code defines a callback function for the property shouldDragStart , which returns
true to indicate to the Java Plugin that the applet can be dragged.
 
Search WWH ::




Custom Search