NamedFrame.getNamedFrame().removeFrame(frameArg); frameArg.dispose();
if(!frameArg.getGlassPane().isVisible()) { NamedFrame.getNamedFrame().removeFrame(frameArg); frameArg.dispose(); }
  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) {	NamedFrame.getNamedFrame().removeFrame(frameArg);	frameArg.dispose();      }    });  }