/** Find the hosting frame, for the file-chooser dialog. */ protected Frame getFrame() { for (Container p = getParent(); p != null; p = p.getParent()) { if (p instanceof Frame) { return (Frame) p; } } return null; }