public Tree getTree() {
        for (Component p = this; (p = p.getParent()) != null;)
            if (p instanceof Tree)
                return (Tree) p;
        return null;