Component c = component; while (c.getParent() != null) c = c.getParent(); if (c instanceof Frame) return (Frame)c; else return null;