Java Reference
In-Depth Information
F The packaging of the code —the javafxpackager tool necessitates using the
-draggable flag so that it generates the applet artifacts accordingly. The
command-line flag causes the code generated for the JavaScript launcher
to include a draggable parameter set to true as shown next:
archive: "draggable-demo.jar",
draggable: true,
width: 200,
height: 75,
code: "draggable.demo.Main",
name: "draggable-demo"
F Running the applet —the applet runs as would any normal applet. However, due to
the Stage extension defined in the code, it will respond to the mouse's drag gesture.
When a user starts dragging the applet body off the browser's page, the Java Plugin
will invoke callback function AppletStageExtension.shouldDragStart . If the
function returns true, then the applet will be allowed to be dragged off the page.
Otherwise the drag gesture will be ignored.
There's more...
Before we leave this recipe, there are some additional items that we should address when
implementing drag-to-install behavior for our applets.
AppletStageExtension Hooks
The JavaFX AppletStageExtension class provides a multitude of useful runtime
information and event hooks for your applet. Here are some you will find useful:
Use this flag to detect if the browser hosting the applet
supports out-of-page dragging.
When this flag is set to true (default), the applet will
automatically receive a floating close box to its right-
hand side (see previous figure). If set to false , the
developer is responsible for providing a mechanism for
closing the applet.
This is called after it has been determined that the
applet is being dragged.
Search WWH ::

Custom Search