Program: 189924
Project: 189924
Buggy source:
public JComponent[] getToolbarComponents(){
  JComponent[] components=new JComponent[6];
  TextModel model=VizController.getInstance().getVizModel().getTextModel();
  final JPopupButton labelSizeModeButton=new JPopupButton();
  TextManager textManager=VizController.getInstance().getTextManager();
  for (  final SizeMode sm : textManager.getSizeModes()) {
    labelSizeModeButton.addItem(sm,sm.getIcon());
  }
  labelSizeModeButton.setSelectedItem(model.getSizeMode());
  labelSizeModeButton.setChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      SizeMode sm=(SizeMode)e.getSource();
      TextModel model=VizController.getInstance().getVizModel().getTextModel();
      model.setSizeMode(sm);
    }
  }
);
  labelSizeModeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("String_Node_Str")));
  labelSizeModeButton.setToolTipText(NbBundle.getMessage(VizBarController.class,"String_Node_Str"));
  model.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      TextModel model=VizController.getInstance().getVizModel().getTextModel();
      if (model.getSizeMode() != labelSizeModeButton.getSelectedItem()) {
        labelSizeModeButton.setSelectedItem(model.getSizeMode());
      }
    }
  }
);
  components[0]=labelSizeModeButton;
  final JPopupButton labelColorModeButton=new JPopupButton();
  for (  final ColorMode cm : textManager.getColorModes()) {
    labelColorModeButton.addItem(cm,cm.getIcon());
  }
  labelColorModeButton.setSelectedItem(textManager.getModel().getColorMode());
  labelColorModeButton.setChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      ColorMode cm=(ColorMode)e.getSource();
      TextModel model=VizController.getInstance().getVizModel().getTextModel();
      model.setColorMode(cm);
    }
  }
);
  labelColorModeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("String_Node_Str")));
  labelColorModeButton.setToolTipText(NbBundle.getMessage(VizBarController.class,"String_Node_Str"));
  model.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      TextModel model=VizController.getInstance().getVizModel().getTextModel();
      if (model.getColorMode() != labelColorModeButton.getSelectedItem()) {
        labelColorModeButton.setSelectedItem(model.getColorMode());
      }
    }
  }
);
  components[1]=labelColorModeButton;
  final JButton fontButton=new JButton(model.getNodeFont().getFontName() + "String_Node_Str" + model.getNodeFont().getSize());
  fontButton.setToolTipText(NbBundle.getMessage(VizBarController.class,"String_Node_Str"));
  fontButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      TextModel model=VizController.getInstance().getVizModel().getTextModel();
      Font font=JFontChooser.showDialog(WindowManager.getDefault().getMainWindow(),model.getNodeFont());
      if (font != null && font != model.getNodeFont()) {
        model.setNodeFont(font);
      }
    }
  }
);
  model.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      TextModel model=VizController.getInstance().getVizModel().getTextModel();
      fontButton.setText(model.getNodeFont().getFontName() + "String_Node_Str" + model.getNodeFont().getSize());
    }
  }
);
  components[2]=fontButton;
  final JSlider fontSizeSlider=new JSlider(0,100,(int)(model.getNodeSizeFactor() * 100f));
  fontSizeSlider.setToolTipText(NbBundle.getMessage(VizBarController.class,"String_Node_Str"));
  fontSizeSlider.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      TextModel model=VizController.getInstance().getVizModel().getTextModel();
      model.setNodeSizeFactor(fontSizeSlider.getValue() / 100f);
    }
  }
);
  fontSizeSlider.setPreferredSize(new Dimension(100,20));
  fontSizeSlider.setMaximumSize(new Dimension(100,20));
  model.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      TextModel model=VizController.getInstance().getVizModel().getTextModel();
      if (((int)(model.getNodeSizeFactor() * 100f)) != fontSizeSlider.getValue()) {
        fontSizeSlider.setValue((int)(model.getNodeSizeFactor() * 100f));
      }
    }
  }
);
  components[3]=fontSizeSlider;
  final ColorChooser colorChooser=new ColorChooser(model.getNodeColor());
  colorChooser.setToolTipText(NbBundle.getMessage(VizBarController.class,"String_Node_Str"));
  colorChooser.setPreferredSize(new Dimension(16,16));
  colorChooser.setMaximumSize(new Dimension(16,16));
  colorChooser.addPropertyChangeListener(new PropertyChangeListener(){
    @Override public void propertyChange(    PropertyChangeEvent evt){
      if (evt.getPropertyName().equals(ColorChooser.PROP_COLOR)) {
        TextModel model=VizController.getInstance().getVizModel().getTextModel();
        model.setNodeColor(colorChooser.getColor());
      }
    }
  }
);
  model.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      TextModel model=VizController.getInstance().getVizModel().getTextModel();
      if (!model.getNodeColor().equals(colorChooser.getColor())) {
        colorChooser.setColor(model.getNodeColor());
      }
    }
  }
);
  components[4]=colorChooser;
  final JButton attributesButton=new JButton();
  attributesButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("String_Node_Str")));
  attributesButton.setToolTipText(NbBundle.getMessage(VizBarController.class,"String_Node_Str"));
  attributesButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      TextModel model=VizController.getInstance().getVizModel().getTextModel();
      LabelAttributesPanel panel=new LabelAttributesPanel();
      panel.setup(model);
      DialogDescriptor dd=new DialogDescriptor(panel,NbBundle.getMessage(VizBarController.class,"String_Node_Str"),true,NotifyDescriptor.OK_CANCEL_OPTION,null,null);
      if (DialogDisplayer.getDefault().notify(dd).equals(NotifyDescriptor.OK_OPTION)) {
        panel.unsetup();
        return;
      }
    }
  }
);
  components[5]=attributesButton;
  return components;
}

Fixed version (ground truth):
public JComponent[] getToolbarComponents(){
  TextModel model=VizController.getInstance().getVizModel().getTextModel();
  final JPopupButton labelSizeModeButton=new JPopupButton();
  TextManager textManager=VizController.getInstance().getTextManager();
  for (  final SizeMode sm : textManager.getSizeModes()) {
    labelSizeModeButton.addItem(sm,sm.getIcon());
  }
  labelSizeModeButton.setSelectedItem(model.getSizeMode());
  labelSizeModeButton.setChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      SizeMode sm=(SizeMode)e.getSource();
      TextModel model=VizController.getInstance().getVizModel().getTextModel();
      model.setSizeMode(sm);
    }
  }
);
  labelSizeModeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("String_Node_Str")));
  labelSizeModeButton.setToolTipText(NbBundle.getMessage(VizBarController.class,"String_Node_Str"));
  model.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      TextModel model=VizController.getInstance().getVizModel().getTextModel();
      if (model.getSizeMode() != labelSizeModeButton.getSelectedItem()) {
        labelSizeModeButton.setSelectedItem(model.getSizeMode());
      }
    }
  }
);
  components[0]=labelSizeModeButton;
  final JPopupButton labelColorModeButton=new JPopupButton();
  for (  final ColorMode cm : textManager.getColorModes()) {
    labelColorModeButton.addItem(cm,cm.getIcon());
  }
  labelColorModeButton.setSelectedItem(textManager.getModel().getColorMode());
  labelColorModeButton.setChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      ColorMode cm=(ColorMode)e.getSource();
      TextModel model=VizController.getInstance().getVizModel().getTextModel();
      model.setColorMode(cm);
    }
  }
);
  labelColorModeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("String_Node_Str")));
  labelColorModeButton.setToolTipText(NbBundle.getMessage(VizBarController.class,"String_Node_Str"));
  model.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      TextModel model=VizController.getInstance().getVizModel().getTextModel();
      if (model.getColorMode() != labelColorModeButton.getSelectedItem()) {
        labelColorModeButton.setSelectedItem(model.getColorMode());
      }
    }
  }
);
  components[1]=labelColorModeButton;
  final JButton fontButton=new JButton(model.getNodeFont().getFontName() + "String_Node_Str" + model.getNodeFont().getSize());
  fontButton.setToolTipText(NbBundle.getMessage(VizBarController.class,"String_Node_Str"));
  fontButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      TextModel model=VizController.getInstance().getVizModel().getTextModel();
      Font font=JFontChooser.showDialog(WindowManager.getDefault().getMainWindow(),model.getNodeFont());
      if (font != null && font != model.getNodeFont()) {
        model.setNodeFont(font);
      }
    }
  }
);
  model.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      TextModel model=VizController.getInstance().getVizModel().getTextModel();
      fontButton.setText(model.getNodeFont().getFontName() + "String_Node_Str" + model.getNodeFont().getSize());
    }
  }
);
  components[2]=fontButton;
  final JSlider fontSizeSlider=new JSlider(0,100,(int)(model.getNodeSizeFactor() * 100f));
  fontSizeSlider.setToolTipText(NbBundle.getMessage(VizBarController.class,"String_Node_Str"));
  fontSizeSlider.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      TextModel model=VizController.getInstance().getVizModel().getTextModel();
      model.setNodeSizeFactor(fontSizeSlider.getValue() / 100f);
    }
  }
);
  fontSizeSlider.setPreferredSize(new Dimension(100,20));
  fontSizeSlider.setMaximumSize(new Dimension(100,20));
  model.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      TextModel model=VizController.getInstance().getVizModel().getTextModel();
      if (((int)(model.getNodeSizeFactor() * 100f)) != fontSizeSlider.getValue()) {
        fontSizeSlider.setValue((int)(model.getNodeSizeFactor() * 100f));
      }
    }
  }
);
  components[3]=fontSizeSlider;
  final ColorChooser colorChooser=new ColorChooser(model.getNodeColor());
  colorChooser.setToolTipText(NbBundle.getMessage(VizBarController.class,"String_Node_Str"));
  colorChooser.setPreferredSize(new Dimension(16,16));
  colorChooser.setMaximumSize(new Dimension(16,16));
  colorChooser.addPropertyChangeListener(new PropertyChangeListener(){
    @Override public void propertyChange(    PropertyChangeEvent evt){
      if (evt.getPropertyName().equals(ColorChooser.PROP_COLOR)) {
        TextModel model=VizController.getInstance().getVizModel().getTextModel();
        model.setNodeColor(colorChooser.getColor());
      }
    }
  }
);
  model.addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      TextModel model=VizController.getInstance().getVizModel().getTextModel();
      if (!model.getNodeColor().equals(colorChooser.getColor())) {
        colorChooser.setColor(model.getNodeColor());
      }
    }
  }
);
  components[4]=colorChooser;
  final JButton attributesButton=new JButton();
  attributesButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("String_Node_Str")));
  attributesButton.setToolTipText(NbBundle.getMessage(VizBarController.class,"String_Node_Str"));
  attributesButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      TextModel model=VizController.getInstance().getVizModel().getTextModel();
      LabelAttributesPanel panel=new LabelAttributesPanel();
      panel.setup(model);
      DialogDescriptor dd=new DialogDescriptor(panel,NbBundle.getMessage(VizBarController.class,"String_Node_Str"),true,NotifyDescriptor.OK_CANCEL_OPTION,null,null);
      if (DialogDisplayer.getDefault().notify(dd).equals(NotifyDescriptor.OK_OPTION)) {
        panel.unsetup();
        return;
      }
    }
  }
);
  components[5]=attributesButton;
  return components;
}