tool.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
  private void addTool(String toolName, String docName, JFrame tool) {    NamedFrame.getNamedFrame().addFrame(toolName + ": " + docName, tool);    final JFrame frameArg = tool;    tool.addWindowListener(new WindowAdapter() {      public void windowClosing(WindowEvent e) {        if(!frameArg.getGlassPane().isVisible()) {          NamedFrame.getNamedFrame().removeFrame(frameArg);          frameArg.dispose();        }      }    });  }