Java Reference
In-Depth Information
onDragFinished:function() This function is called when the drag gesture is finished.
onAppletRestored:function() This function is called when the applet is closed by
the user (or programmatically) while the original
source web page is still opened. Then, the applet is
restored back into the page .
Preventing unintentional dragging
One technique used with draggable applets, to control unintentional dragging, is to detect
the pressing of a control key while dragging. To do this, we can modify our sample app by
changing the shouldDragStart function attribute:
Stage {
...
extensions: [
AppletStageExtension {
shouldDragStart: function(e:MouseEvent): Boolean {
return e.altDown and e.primaryButton;
}
}
]
}
With this change, the applet will only be dragged when the Alt key and the mouse's primary
button are both pressed together while dragging.
Control post-installation behavior
Let's discuss one last important point about applet dragging, then we are done. Recall
that an applet is rendered as an undecorated borderless window without any drag handles.
So, when you set up your app as drag-to-install, you must provide windowing controls
(close, move, minimize, maximize, and so on) to your users, so that when the application
is subsequently launched as a desktop application through Web Start, it can also be closed
or moved around the desktop.
One way to handle this situation is to use the AppletStageExtension properties, coupled
with the {__PROFILE__} pseudo variable, to determine how and when to display window
handles and decoration. You can use that value to properly set up windowing controls based
on the profile. For instance, when {__PROFILE__} = "desktop" , display windowing
controls in the application.
See also
F Building and packaging your app with javafxpackager
F Packaging your app to be Web Start(ed)
F Packaging your app as an applet
Search WWH ::




Custom Search