Program: 16650
Project: 16650
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);
  Box hBox0=Box.createHorizontalBox();
  hBox0.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");
    }
  }
);
  hBox0.add(show);
  hBox0.add(Box.createGlue());
  for (int str=0; str < multAln.size(); str++) {
    JCheckBox structureSelection=new JCheckBox(multAln.getEnsemble().getStructureNames().get(str));
    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();
  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){
      System.out.println("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();
  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 hBox0=Box.createHorizontalBox();
    hBox0.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");
      }
    }
);
    hBox0.add(show);
    hBox0.add(Box.createGlue());
    for (int str=0; str < multAln.size(); str++) {
      JCheckBox structureSelection=new JCheckBox(multAln.getEnsemble().getStructureNames().get(str));
      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();
  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){
      System.out.println("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();
}