public void awake() {
   if (shouldDisplayMainMenuBar()) {
     mainMenuBar = XJMainMenuBar.createInstance();
     mainMenuBar.setCustomizer(this);
     mainMenuBar.setDelegate(this);
     mainMenuBar.createMenuBar();
     setMainMenuBar(mainMenuBar);
     undoEngine.setMainMenuBar(mainMenuBar);
   }
 }
  public void close() {
    XJMainMenuBar.removeInstance(mainMenuBar);
    if (mainMenuBar != null) {
      mainMenuBar.setDelegate(null);
      mainMenuBar = null;
    }

    saveWindowBounds();

    jFrame.dispose();
    jFrame = null;

    if (delegate != null) delegate.frameDidClose(this);
  }