public void clearWidgetFromMouse() { if (widget != null) { detachHandlers(); /* * Do not use widget.removeFromParent() since the parent might not * be "parent" if the widget has been attached to another parent * meanwhile (which is very likely) */ parent.remove(widget); widget = null; } }