28 Nov 2010 audriusa   » (Journeyer)

Started to work on applet undocking for my Ultrastudio.org. Many applets we have work nicely with various dimensions and pulling them out if preferred seems increasingly attractive idea. Oracle's JRE even has some native undocking capabilities but it is rather cryptic, goes through some JavaScript stuff on Oracle website and of course I need to get this working with IceTea. Seems better to add a couple of classes to the applet jar and have full control.

It is surprisingly simple to undock the applet: the code that does this simply removes it from some mysterious container where it is attached on a browser and then is free to place it into trivial JFrame. It is even possible to reattach the applet to its browser container when the user closes this JFrame (inside the window listener).

It is more difficult to implement support, how to signal that we want to undock the applet. Oracle talks something about dragging out with ALT key pressed but with my IceTea seems not working very well - I can register mouse listener on applet but majority of mouse exit events do not get delivered. Adding a button into JLayeredPane seems more promising: inside this pane, the button is nicely over the rest of the applet, exactly in location I can set with setBounds(...) and reacts to mouse click, calling my action listener. The new problem is that the button is covering part of the applet interface; thinking that to do now. Maybe the button can be auto-hidded after several seconds of run.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!