Applet Dragging in Linux

Being a Linux user, I watched those applet dragging demos with envy when they only worked on Windows. When the release candidate of JDK 6 update 10 (now there is a product name only a mother could love...) came out, I was eager to try it out on Linux. Initially, I was held back by a factor entirely beyond my control, i.e. my cluelessness and unwillingness to read the docs. Thanks to Aaron Houston and Ken Russell for helping me out. Here are the steps:

  1. First off, you need to make sure that the new functionality is actually enabled. The Linux installer for JDK 6 update 10 doesn't do that for you. You must remove the symlink to the old plugin from your plugins directory (such as ~/.mozilla/plugins) and add a symlink to /path/to/jdk1.6.0/jre/lib/i386/libnpjp2.so. For example,
    ln -s ~/jdk1.6.0/jre/lib/i386/libnpjp2.so ~/.mozilla/plugins/libnpjp2.so
    This is explained here.
  2. The applet drag gesture is Alt + click, which unfortunately conflicts with the Gnome gesture to drag a window. As explained here, you can write code in your applet to have a different drag gesture, but that seems daft—how are you supposed to know what goes on with the window manager of the person viewing your applet? Maybe Sun could have done a better job here and identify suitable gestures for each platform? At this point, the easiest way around the problem is to reconfigure Gnome. Select System → Preferences → Window, then pick some other key than Alt for window dragging:
  3. Finally, keep in mind that this doesn't work automatically for all applets. You need to go to the applet code and add a parameter <param name="draggable" value="true">Try it out: Point your browser here and use Alt+Drag to move the applet anywhere you like.