Program: 16310
Project: 16310
Buggy source:
/** 
 * The constructor displays the Mutltiple Alignment in a new JmolPanel Frame.
 * @param msa : contains the aligned residues.
 * @param rotatedAtoms : contains the transformed Atom coordinates.
 */
public MultipleAlignmentJmol(MultipleAlignment msa,List<Atom[]> rotatedAtoms){
  AligUIManager.setLookAndFeel();
  nrOpenWindows++;
  jmolPanel=new JmolPanel();
  frame=new JFrame();
  JMenuBar menu=MenuCreator.initJmolMenu(frame,this,null,msa);
  frame.setJMenuBar(menu);
  this.multAln=msa;
  this.transformedAtoms=rotatedAtoms;
  this.selectedStructures=new ArrayList<JCheckBox>();
  frame.addWindowListener(new WindowAdapter(){
    @Override public void windowClosing(    WindowEvent e){
      nrOpenWindows--;
      destroy();
      if (nrOpenWindows > 0)       frame.dispose();
 else {
        MultipleAlignmentGUI gui=MultipleAlignmentGUI.getInstanceNoVisibilityChange();
        if (gui.isVisible()) {
          frame.dispose();
          gui.requestFocus();
        }
 else         System.exit(0);
      }
    }
  }
);
  Container contentPane=frame.getContentPane();
  Box vBox=Box.createVerticalBox();
  jmolPanel.addMouseMotionListener(this);
  jmolPanel.addMouseListener(this);
  jmolPanel.setPreferredSize(new Dimension(DEFAULT_WIDTH,DEFAULT_HEIGHT));
  vBox.add(jmolPanel);
  JTextField field=new JTextField();
  field.setMaximumSize(new Dimension(Short.MAX_VALUE,30));
  field.setText(COMMAND_LINE_HELP);
  RasmolCommandListener listener=new RasmolCommandListener(jmolPanel,field);
  field.addActionListener(listener);
  field.addMouseListener(listener);
  field.addKeyListener(listener);
  vBox.add(field);
  if (multAln != null) {
    Box hBox00=Box.createHorizontalBox();
    hBox00.setMaximumSize(new Dimension(Short.MAX_VALUE,30));
    JButton show=new JButton("String_Node_Str");
    show.addActionListener(new ActionListener(){
      @Override public void actionPerformed(      ActionEvent e){
        jmolPanel.evalString("String_Node_Str");
        String cmd=getJmolString(multAln,transformedAtoms,colorPalette,colorByBlocks.isSelected());
        cmd+="String_Node_Str";
        for (int st=0; st < multAln.size(); st++) {
          if (selectedStructures.get(st).isSelected()) {
            cmd+="String_Node_Str" + (st + 1) + "String_Node_Str";
          }
        }
        cmd+="String_Node_Str";
        jmolPanel.executeCmd(cmd + "String_Node_Str");
      }
    }
);
    hBox00.add(show);
    hBox00.add(Box.createGlue());
    vBox.add(hBox00);
    for (int line=0; line < 1 + (multAln.size() / 5); line++) {
      Box hBox0=Box.createHorizontalBox();
      hBox0.setMaximumSize(new Dimension(Short.MAX_VALUE,30));
      for (int str=line * 5; str < Math.min((line + 1) * 5,multAln.size()); str++) {
        JCheckBox structureSelection=new JCheckBox(multAln.getEnsemble().getStructureIdentifiers().get(str).getIdentifier());
        hBox0.add(structureSelection);
        hBox0.add(Box.createGlue());
        structureSelection.setSelected(true);
        selectedStructures.add(structureSelection);
      }
      vBox.add(hBox0);
    }
  }
  Box hBox1=Box.createHorizontalBox();
  hBox1.add(Box.createGlue());
  String[] styles=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  JComboBox style=new JComboBox(styles);
  hBox1.setMaximumSize(new Dimension(Short.MAX_VALUE,30));
  hBox1.add(new JLabel("String_Node_Str"));
  hBox1.add(style);
  vBox.add(hBox1);
  contentPane.add(vBox);
  style.addActionListener(jmolPanel);
  String[] colorModes=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  JComboBox jcolors=new JComboBox(colorModes);
  jcolors.addActionListener(jmolPanel);
  hBox1.add(Box.createGlue());
  hBox1.add(new JLabel("String_Node_Str"));
  hBox1.add(jcolors);
  String[] cPalette={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  JComboBox palette=new JComboBox(cPalette);
  palette.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      JComboBox source=(JComboBox)e.getSource();
      String value=source.getSelectedItem().toString();
      evalString("String_Node_Str" + "String_Node_Str");
      if (value == "String_Node_Str") {
        colorPalette=ColorBrewer.Set1;
      }
 else       if (value == "String_Node_Str") {
        colorPalette=ColorBrewer.Set2;
      }
 else       if (value == "String_Node_Str") {
        colorPalette=ColorBrewer.Spectral;
      }
 else       if (value == "String_Node_Str") {
        colorPalette=ColorBrewer.Pastel1;
      }
      String script=getJmolString(multAln,transformedAtoms,colorPalette,colorByBlocks.isSelected());
      evalString(script + "String_Node_Str");
    }
  }
);
  hBox1.add(Box.createGlue());
  hBox1.add(new JLabel("String_Node_Str"));
  hBox1.add(palette);
  Box hBox2=Box.createHorizontalBox();
  JButton resetDisplay=new JButton("String_Node_Str");
  resetDisplay.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      logger.info("String_Node_Str");
      jmolPanel.executeCmd("String_Node_Str");
    }
  }
);
  hBox2.add(resetDisplay);
  hBox2.add(Box.createGlue());
  JCheckBox toggleSelection=new JCheckBox("String_Node_Str");
  toggleSelection.addItemListener(new ItemListener(){
    @Override public void itemStateChanged(    ItemEvent e){
      boolean showSelection=(e.getStateChange() == ItemEvent.SELECTED);
      if (showSelection) {
        jmolPanel.executeCmd("String_Node_Str");
      }
 else       jmolPanel.executeCmd("String_Node_Str");
    }
  }
);
  hBox2.add(toggleSelection);
  hBox2.add(Box.createGlue());
  colorByBlocks=new JCheckBox("String_Node_Str");
  colorByBlocks.addItemListener(new ItemListener(){
    @Override public void itemStateChanged(    ItemEvent e){
      evalString("String_Node_Str" + getJmolString(multAln,transformedAtoms,colorPalette,colorByBlocks.isSelected()) + "String_Node_Str");
    }
  }
);
  hBox2.add(colorByBlocks);
  hBox2.add(Box.createGlue());
  vBox.add(hBox2);
  Box hBox=Box.createHorizontalBox();
  status=new JTextField();
  status.setBackground(Color.white);
  status.setEditable(false);
  status.setMaximumSize(new Dimension(Short.MAX_VALUE,30));
  status.setPreferredSize(new Dimension(DEFAULT_WIDTH / 2,30));
  status.setMinimumSize(new Dimension(DEFAULT_WIDTH / 2,30));
  hBox.add(status);
  text=new JTextField();
  text.setBackground(Color.white);
  text.setMaximumSize(new Dimension(Short.MAX_VALUE,30));
  text.setPreferredSize(new Dimension(DEFAULT_WIDTH / 2,30));
  text.setMinimumSize(new Dimension(DEFAULT_WIDTH / 2,30));
  text.setText("String_Node_Str");
  text.setEditable(false);
  hBox.add(text);
  vBox.add(hBox);
  contentPane.add(vBox);
  MyJmolStatusListener li=(MyJmolStatusListener)jmolPanel.getStatusListener();
  li.setTextField(status);
  frame.pack();
  frame.setVisible(true);
  initCoords();
  resetDisplay();
}

Fixed version (ground truth):
/** 
 * The constructor displays the Mutltiple Alignment in a new JmolPanel Frame.
 * @param msa : contains the aligned residues.
 * @param rotatedAtoms : contains the transformed Atom coordinates.
 */
public MultipleAlignmentJmol(MultipleAlignment msa,List<Atom[]> rotatedAtoms){
  AligUIManager.setLookAndFeel();
  nrOpenWindows++;
  jmolPanel=new JmolPanel();
  frame=new JFrame();
  JMenuBar menu=MenuCreator.initJmolMenu(frame,this,null,msa);
  frame.setJMenuBar(menu);
  this.multAln=msa;
  this.transformedAtoms=rotatedAtoms;
  this.selectedStructures=new ArrayList<JCheckBox>();
  frame.addWindowListener(new WindowAdapter(){
    @Override public void windowClosing(    WindowEvent e){
      nrOpenWindows--;
      destroy();
      if (nrOpenWindows > 0)       frame.dispose();
 else {
        MultipleAlignmentGUI gui=MultipleAlignmentGUI.getInstanceNoVisibilityChange();
        if (gui.isVisible()) {
          frame.dispose();
          gui.requestFocus();
        }
 else         System.exit(0);
      }
    }
  }
);
  Container contentPane=frame.getContentPane();
  jmolPanel.addMouseMotionListener(this);
  jmolPanel.addMouseListener(this);
  jmolPanel.setPreferredSize(new Dimension(DEFAULT_WIDTH,DEFAULT_HEIGHT));
  contentPane.add(jmolPanel,BorderLayout.CENTER);
  Box vBox=Box.createVerticalBox();
  JTextField field=new JTextField();
  field.setMaximumSize(new Dimension(Short.MAX_VALUE,30));
  field.setText(COMMAND_LINE_HELP);
  RasmolCommandListener listener=new RasmolCommandListener(jmolPanel,field);
  field.addActionListener(listener);
  field.addMouseListener(listener);
  field.addKeyListener(listener);
  vBox.add(field);
  if (multAln != null) {
    JPanel modelSelection=new JPanel();
    modelSelection.setLayout(new WrapLayout(WrapLayout.LEFT));
    modelSelection.setSize(new Dimension(DEFAULT_WIDTH,30));
    vBox.add(modelSelection);
    JButton show=new JButton("String_Node_Str");
    show.addActionListener(new ActionListener(){
      @Override public void actionPerformed(      ActionEvent e){
        jmolPanel.evalString("String_Node_Str");
        String cmd=getJmolString(multAln,transformedAtoms,colorPalette,colorByBlocks.isSelected());
        cmd+="String_Node_Str";
        for (int st=0; st < multAln.size(); st++) {
          if (selectedStructures.get(st).isSelected()) {
            cmd+="String_Node_Str" + (st + 1) + "String_Node_Str";
          }
        }
        cmd+="String_Node_Str";
        jmolPanel.executeCmd(cmd + "String_Node_Str");
      }
    }
);
    modelSelection.add(show);
    for (int str=0; str < multAln.size(); str++) {
      JCheckBox structureSelection=new JCheckBox(multAln.getEnsemble().getStructureIdentifiers().get(str).getIdentifier());
      modelSelection.add(structureSelection);
      structureSelection.setSelected(true);
      selectedStructures.add(structureSelection);
    }
  }
  Box hBox1=Box.createHorizontalBox();
  hBox1.add(Box.createGlue());
  String[] styles=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  JComboBox<String> style=new JComboBox<>(styles);
  hBox1.setMaximumSize(new Dimension(Short.MAX_VALUE,30));
  hBox1.add(new JLabel("String_Node_Str"));
  hBox1.add(style);
  vBox.add(hBox1);
  style.addActionListener(jmolPanel);
  String[] colorModes=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  JComboBox<String> jcolors=new JComboBox<>(colorModes);
  jcolors.addActionListener(jmolPanel);
  hBox1.add(Box.createGlue());
  hBox1.add(new JLabel("String_Node_Str"));
  hBox1.add(jcolors);
  String[] cPalette={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  JComboBox<String> palette=new JComboBox<>(cPalette);
  palette.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      @SuppressWarnings("String_Node_Str") JComboBox<String> source=(JComboBox<String>)e.getSource();
      String value=source.getSelectedItem().toString();
      evalString("String_Node_Str" + "String_Node_Str");
      if (value == "String_Node_Str") {
        colorPalette=ColorBrewer.Set1;
      }
 else       if (value == "String_Node_Str") {
        colorPalette=ColorBrewer.Set2;
      }
 else       if (value == "String_Node_Str") {
        colorPalette=ColorBrewer.Spectral;
      }
 else       if (value == "String_Node_Str") {
        colorPalette=ColorBrewer.Pastel1;
      }
      String script=getJmolString(multAln,transformedAtoms,colorPalette,colorByBlocks.isSelected());
      evalString(script + "String_Node_Str");
    }
  }
);
  hBox1.add(Box.createGlue());
  hBox1.add(new JLabel("String_Node_Str"));
  hBox1.add(palette);
  Box hBox2=Box.createHorizontalBox();
  hBox2.setMaximumSize(new Dimension(Short.MAX_VALUE,30));
  JButton resetDisplay=new JButton("String_Node_Str");
  resetDisplay.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      logger.info("String_Node_Str");
      jmolPanel.executeCmd("String_Node_Str");
    }
  }
);
  hBox2.add(resetDisplay);
  hBox2.add(Box.createGlue());
  JCheckBox toggleSelection=new JCheckBox("String_Node_Str");
  toggleSelection.addItemListener(new ItemListener(){
    @Override public void itemStateChanged(    ItemEvent e){
      boolean showSelection=(e.getStateChange() == ItemEvent.SELECTED);
      if (showSelection) {
        jmolPanel.executeCmd("String_Node_Str");
      }
 else       jmolPanel.executeCmd("String_Node_Str");
    }
  }
);
  hBox2.add(toggleSelection);
  hBox2.add(Box.createGlue());
  colorByBlocks=new JCheckBox("String_Node_Str");
  colorByBlocks.addItemListener(new ItemListener(){
    @Override public void itemStateChanged(    ItemEvent e){
      evalString("String_Node_Str" + getJmolString(multAln,transformedAtoms,colorPalette,colorByBlocks.isSelected()) + "String_Node_Str");
    }
  }
);
  hBox2.add(colorByBlocks);
  hBox2.add(Box.createGlue());
  vBox.add(hBox2);
  Box hBox=Box.createHorizontalBox();
  status=new JTextField();
  status.setBackground(Color.white);
  status.setEditable(false);
  status.setMaximumSize(new Dimension(Short.MAX_VALUE,30));
  status.setPreferredSize(new Dimension(DEFAULT_WIDTH / 2,30));
  status.setMinimumSize(new Dimension(DEFAULT_WIDTH / 2,30));
  hBox.add(status);
  text=new JTextField();
  text.setBackground(Color.white);
  text.setMaximumSize(new Dimension(Short.MAX_VALUE,30));
  text.setPreferredSize(new Dimension(DEFAULT_WIDTH / 2,30));
  text.setMinimumSize(new Dimension(DEFAULT_WIDTH / 2,30));
  text.setText("String_Node_Str");
  text.setEditable(false);
  hBox.add(text);
  vBox.add(hBox);
  contentPane.add(vBox,BorderLayout.SOUTH);
  MyJmolStatusListener li=(MyJmolStatusListener)jmolPanel.getStatusListener();
  li.setTextField(status);
  frame.pack();
  frame.setVisible(true);
  initCoords();
  resetDisplay();
}