toUse = SwingUtilities.getOwnerFrame();
toUse = (Frame) SwingUtilities.getOwnerFrame(null);
  protected JDialog createDialog(Component parent) throws HeadlessException  {    Frame toUse = (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parent);    if (toUse == null)      toUse = SwingUtilities.getOwnerFrame();    JDialog dialog = new JDialog(toUse);    setSelectedFile(null);    dialog.getContentPane().add(this);    dialog.setModal(true);    dialog.invalidate();    dialog.repaint();    return dialog;  }