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);
  }
  public void menuItemStatusChanged(int tag) {
    if (mainMenuBar == null) return;

    XJMainMenuBar.refreshAllMenuBars();
    mainMenuBar.refreshState();
  }
 public void setMainMenuBar(XJMainMenuBar menubar) {
   this.mainMenuBar = menubar;
   jFrame.setJMenuBar(mainMenuBar.getJMenuBar());
 }