static Window getWindow(Object o) { if (!(o instanceof Component)) ret null; Component c = (Component) o; while (c != null) { if (c instanceof Window) return (Window) c; c = c.getParent(); } ret null; }