Program: 16530
Project: 16530
Buggy source:
/** 
 * Provide a JMenuBar that can be added to a JFrame containing  a JmolPanel. The alignment has to be either an AFPChain or a MultipleAlignment: set the other parameter to null.<p> Menus included: <ul><li>File: open, save, export, import, exit. <li>Align: new pairwise alignment, new multiple alignment. <li>View: aligment panel, aligned pairs, text format,  FatCat format, distance matrices, dot plot. <li>Help </ul>
 * @return a JMenuBar
 */
public static JMenuBar initJmolMenu(JFrame frame,AbstractAlignmentJmol parent,AFPChain afpChain,MultipleAlignment msa){
  JMenuBar menu=new JMenuBar();
  JMenu file=new JMenu("String_Node_Str");
  file.setMnemonic(KeyEvent.VK_F);
  file.getAccessibleContext().setAccessibleDescription("String_Node_Str");
  if (parent != null) {
    JMenuItem loadF=getLoadMenuItem();
    loadF.addActionListener(new MyAlignmentLoadListener());
    file.add(loadF);
  }
  JMenuItem saveF=getSaveAlignmentMenuItem(afpChain,msa);
  file.add(saveF);
  JMenuItem openPDB=getShowPDBMenuItem();
  file.add(openPDB);
  JMenuItem openI=getOpenPDBMenuItem();
  file.add(openI);
  if (parent != null) {
    JMenuItem exportI=getExportPDBMenuItem(parent);
    file.add(exportI);
  }
  JMenuItem openDBI=getDBResultMenuItem();
  file.add(openDBI);
  file.addSeparator();
  if (parent != null) {
    JMenuItem print=getPrintMenuItem();
    print.addActionListener(parent.getJmolPanel());
    file.add(print);
  }
  file.addSeparator();
  JMenuItem closeI=getCloseMenuItem(frame);
  file.add(closeI);
  JMenuItem exitI=getExitMenuItem();
  file.add(exitI);
  menu.add(file);
  JMenu align=new JMenu("String_Node_Str");
  align.setMnemonic(KeyEvent.VK_A);
  JMenuItem pairI=getPairwiseAlignmentMenuItem();
  align.add(pairI);
  JMenuItem multI=getMultipleAlignmentMenuItem();
  align.add(multI);
  menu.add(align);
  JMenu view=new JMenu("String_Node_Str");
  view.getAccessibleContext().setAccessibleDescription("String_Node_Str");
  view.setMnemonic(KeyEvent.VK_V);
  if (parent != null) {
    JMenuItem apI=MenuCreator.getIcon(parent,ALIGNMENT_PANEL);
    apI.setMnemonic(KeyEvent.VK_M);
    apI.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M,keyMask));
    view.add(apI);
    JMenuItem textI=MenuCreator.getIcon(parent,TEXT_ONLY);
    textI.setMnemonic(KeyEvent.VK_T);
    view.add(textI);
    JMenuItem pairsI=MenuCreator.getIcon(parent,PAIRS_ONLY);
    pairsI.setMnemonic(KeyEvent.VK_P);
    view.add(pairsI);
    JMenuItem textF=MenuCreator.getIcon(parent,FATCAT_TEXT);
    textF.setMnemonic(KeyEvent.VK_F);
    view.add(textF);
    JMenuItem distMax=new JMenuItem(DIST_MATRICES);
    distMax.setMnemonic(KeyEvent.VK_D);
    distMax.addActionListener(new MyDistMaxListener(parent));
    view.add(distMax);
    if (afpChain != null) {
      JMenuItem dotplot=new JMenuItem(DOT_PLOT);
      dotplot.setMnemonic(KeyEvent.VK_O);
      dotplot.addActionListener(new DotPlotListener(afpChain));
      view.add(dotplot);
    }
    if (afpChain == null) {
      JMenuItem tree=new JMenuItem(PHYLOGENETIC_TREE);
      tree.setMnemonic(KeyEvent.VK_T);
      view.add(tree);
    }
  }
  menu.add(view);
  JMenu about=new JMenu("String_Node_Str");
  about.setMnemonic(KeyEvent.VK_H);
  JMenuItem helpM=getHelpMenuItem();
  about.add(helpM);
  JMenuItem aboutM=getAboutMenuItem();
  about.add(aboutM);
  menu.add(Box.createGlue());
  menu.add(about);
  return menu;
}

Fixed version (ground truth):
/** 
 * Provide a JMenuBar that can be added to a JFrame containing  a JmolPanel. The alignment has to be either an AFPChain or a MultipleAlignment: set the other parameter to null.<p> Menus included: <ul><li>File: open, save, export, import, exit. <li>Align: new pairwise alignment, new multiple alignment. <li>View: aligment panel, aligned pairs, text format,  FatCat format, distance matrices, dot plot. <li>Help </ul>
 * @return a JMenuBar
 */
public static JMenuBar initJmolMenu(JFrame frame,AbstractAlignmentJmol parent,AFPChain afpChain,MultipleAlignment msa){
  JMenuBar menu=new JMenuBar();
  JMenu file=new JMenu("String_Node_Str");
  file.setMnemonic(KeyEvent.VK_F);
  file.getAccessibleContext().setAccessibleDescription("String_Node_Str");
  if (parent != null) {
    JMenuItem loadF=getLoadMenuItem();
    loadF.addActionListener(new MyAlignmentLoadListener());
    file.add(loadF);
  }
  JMenuItem saveF=getSaveAlignmentMenuItem(afpChain,msa);
  file.add(saveF);
  JMenuItem openPDB=getShowPDBMenuItem();
  file.add(openPDB);
  JMenuItem openI=getOpenPDBMenuItem();
  file.add(openI);
  if (parent != null) {
    JMenuItem exportI=getExportPDBMenuItem(parent);
    file.add(exportI);
  }
  JMenuItem openDBI=getDBResultMenuItem();
  file.add(openDBI);
  file.addSeparator();
  if (parent != null) {
    JMenuItem print=getPrintMenuItem();
    print.addActionListener(parent.getJmolPanel());
    file.add(print);
  }
  file.addSeparator();
  JMenuItem closeI=getCloseMenuItem(frame);
  file.add(closeI);
  JMenuItem exitI=getExitMenuItem();
  file.add(exitI);
  menu.add(file);
  JMenu align=new JMenu("String_Node_Str");
  align.setMnemonic(KeyEvent.VK_A);
  JMenuItem pairI=getPairwiseAlignmentMenuItem();
  align.add(pairI);
  JMenuItem multI=getMultipleAlignmentMenuItem();
  align.add(multI);
  menu.add(align);
  JMenu view=new JMenu("String_Node_Str");
  view.getAccessibleContext().setAccessibleDescription("String_Node_Str");
  view.setMnemonic(KeyEvent.VK_V);
  if (parent != null) {
    JMenuItem apI=MenuCreator.getIcon(parent,ALIGNMENT_PANEL);
    apI.setMnemonic(KeyEvent.VK_M);
    apI.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M,keyMask));
    view.add(apI);
    JMenuItem textI=MenuCreator.getIcon(parent,TEXT_ONLY);
    textI.setMnemonic(KeyEvent.VK_T);
    view.add(textI);
    JMenuItem pairsI=MenuCreator.getIcon(parent,PAIRS_ONLY);
    pairsI.setMnemonic(KeyEvent.VK_P);
    view.add(pairsI);
    JMenuItem textF=MenuCreator.getIcon(parent,FATCAT_TEXT);
    textF.setMnemonic(KeyEvent.VK_F);
    view.add(textF);
    JMenuItem distMax=new JMenuItem(DIST_MATRICES);
    distMax.setMnemonic(KeyEvent.VK_D);
    distMax.addActionListener(new MyDistMaxListener(parent));
    view.add(distMax);
    if (afpChain != null) {
      JMenuItem dotplot=new JMenuItem(DOT_PLOT);
      dotplot.setMnemonic(KeyEvent.VK_O);
      dotplot.addActionListener(new DotPlotListener(afpChain));
      view.add(dotplot);
    }
    if (afpChain == null) {
      JMenuItem tree=getIcon(parent,PHYLOGENETIC_TREE);
      tree.setMnemonic(KeyEvent.VK_T);
      view.add(tree);
    }
  }
  menu.add(view);
  JMenu about=new JMenu("String_Node_Str");
  about.setMnemonic(KeyEvent.VK_H);
  JMenuItem helpM=getHelpMenuItem();
  about.add(helpM);
  JMenuItem aboutM=getAboutMenuItem();
  about.add(aboutM);
  menu.add(Box.createGlue());
  menu.add(about);
  return menu;
}