Buggy code:
public class AutoAnnotatorPanel extends JPanel implements CytoPanelComponent { private static final long serialVersionUID = 7901088595186775935L ; private String clusterColumnName ; private String nameColumnName ; private long networkID ; protected AutoAnnotatorTaskFactory autoAnnotatorTaskFactory ; public AutoAnnotatorPanel ( CyApplicationManager cyApplicationManagerRef , CyNetworkViewManager cyNetworkViewManagerRef , CySwingApplication cySwingApplicationRef , OpenBrowser openBrowserRef , CyNetworkManager cyNetworkManagerRef , AnnotationManager annotationManager , CyServiceRegistrar registrar , DialogTaskManager dialogTaskManager , CyEventHelper eventHelper ) { } private JPanel createMainPanel ( final CyApplicationManager cyApplicationManagerRef , final CyNetworkViewManager cyNetworkViewManagerRef , final CySwingApplication cySwingApplicationRef , final OpenBrowser openBrowserRef , final CyNetworkManager cyNetworkManagerRef , final AnnotationManager annotationManager , final CyServiceRegistrar registrar , final DialogTaskManager dialogTaskManager , final CyEventHelper eventHelper ) { JPanel mainPanel = new JPanel ( ) ; mainPanel . setLayout ( new BoxLayout ( mainPanel , BoxLayout . PAGE_AXIS ) ) ; final JComboBox networkDropdown = new JComboBox ( ) ; final HashMap < String , Long > nameToSUID = new HashMap < String , Long > ( ) ; for ( CyNetwork network : cyNetworkManagerRef . getNetworkSet ( ) ) { String name = network . toString ( ) ; long suid = network . getSUID ( ) ; networkDropdown . addItem ( name ) ; nameToSUID . put ( name , suid ) ; } final JComboBox nameColumnDropdown = updatingDropdownColumnName ( networkDropdown , nameToSUID , cyNetworkManagerRef ) ; nameColumnDropdown . addItemListener ( new ItemListener ( ) { public void itemStateChanged ( ItemEvent itemEvent ) { nameColumnName = ( ( String ) ( itemEvent . getItem ( ) ) ) ; } } ) ; final JComboBox clusterColumnDropdown = updatingDropdownColumnName ( networkDropdown , nameToSUID , cyNetworkManagerRef ) ; clusterColumnDropdown . addItemListener ( new ItemListener ( ) { public void itemStateChanged ( ItemEvent itemEvent ) { clusterColumnName = ( ( String ) ( itemEvent . getItem ( ) ) ) ; } } ) ; JButton confirmButton = new JButton ( "Annotate!" ) ; final Map < String , String > serviceProperties = new HashMap < String , String > ( ) ; serviceProperties . put ( "inMenuBar" , "true" ) ; serviceProperties . put ( "preferredMenu" , "Apps.EnrichmentMap" ) ; ActionListener autoAnnotateAction = new ActionListener ( ) { public void actionPerformed ( ActionEvent e ) { autoAnnotatorTaskFactory = new AutoAnnotatorTaskFactory ( cySwingApplicationRef , cyApplicationManagerRef , openBrowserRef , cyNetworkViewManagerRef , cyNetworkManagerRef , annotationManager , networkID , clusterColumnName , nameColumnName , registrar ) ; dialogTaskManager . execute ( autoAnnotatorTaskFactory . createTaskIterator ( ) ) ; } } ; confirmButton . addActionListener ( autoAnnotateAction ) ; JButton updateButton = new JButton ( "Update" ) ; ActionListener updateActionListener = new ActionListener ( ) { public void actionPerformed ( ActionEvent e ) { networkDropdown . removeAllItems ( ) ; for ( CyNetwork network : cyNetworkManagerRef . getNetworkSet ( ) ) { String name = network . toString ( ) ; long suid = network . getSUID ( ) ; networkDropdown . addItem ( name ) ; nameToSUID . put ( name , suid ) ; } } } ; updateButton . addActionListener ( updateActionListener ) ; JLabel networkDropdownLabel = new JLabel ( "Select<seq2seq4repair_space>the<seq2seq4repair_space>network<seq2seq4repair_space>to<seq2seq4repair_space>annotate:" ) ; JLabel clusterColumnDropdownLabel = new JLabel ( "Select<seq2seq4repair_space>the<seq2seq4repair_space>column<seq2seq4repair_space>with<seq2seq4repair_space>the<seq2seq4repair_space>clusters:" ) ; JLabel nameColumnDropdownLabel = new JLabel ( "Select<seq2seq4repair_space>the<seq2seq4repair_space>column<seq2seq4repair_space>with<seq2seq4repair_space>the<seq2seq4repair_space>gene<seq2seq4repair_space>set<seq2seq4repair_space>names:" ) ; JButton clearButton = new JButton ( "Clear<seq2seq4repair_space>Annotations" ) ; ActionListener clearActionListener = new ActionListener ( ) { public void actionPerformed ( ActionEvent e ) { CyNetwork network = cyNetworkManagerRef . getNetwork ( nameToSUID . get ( networkDropdown . getSelectedItem ( ) ) ) ; CyNetworkView networkView = ( ( CyNetworkView ) ( cyNetworkViewManagerRef . getNetworkViews ( network ) . toArray ( ) [ 0 ] ) ) ; List < Annotation > annotations = annotationManager . getAnnotations ( networkView ) ; for ( Annotation a : annotations ) { <START_BUG> annotationManager . removeAnnotation ( a ) ; <END_BUG> } eventHelper . flushPayloadEvents ( ) ; networkView . updateView ( ) ; } } ; clearButton . addActionListener ( clearActionListener ) ; networkDropdownLabel . setAlignmentX ( Component . LEFT_ALIGNMENT ) ; networkDropdown . setAlignmentX ( Component . LEFT_ALIGNMENT ) ; nameColumnDropdownLabel . setAlignmentX ( Component . LEFT_ALIGNMENT ) ; nameColumnDropdown . setAlignmentX ( Component . LEFT_ALIGNMENT ) ; clusterColumnDropdownLabel . setAlignmentX ( Component . LEFT_ALIGNMENT ) ; clusterColumnDropdown . setAlignmentX ( Component . LEFT_ALIGNMENT ) ; confirmButton . setAlignmentX ( Component . LEFT_ALIGNMENT ) ; updateButton . setAlignmentX ( Component . LEFT_ALIGNMENT ) ; clearButton . setAlignmentX ( Component . LEFT_ALIGNMENT ) ; mainPanel . add ( networkDropdownLabel ) ; mainPanel . add ( networkDropdown ) ; mainPanel . add ( updateButton ) ; mainPanel . add ( nameColumnDropdownLabel ) ; mainPanel . add ( nameColumnDropdown ) ; mainPanel . add ( clusterColumnDropdownLabel ) ; mainPanel . add ( clusterColumnDropdown ) ; mainPanel . add ( confirmButton ) ; mainPanel . add ( clearButton ) ; return mainPanel ; } private JComboBox updatingDropdownColumnName ( JComboBox networkDropdown , final HashMap < String , Long > nameToSUID , final CyNetworkManager cyNetworkManagerRef ) { } @ Override public Component getComponent ( ) { } @ Override public CytoPanelName getCytoPanelName ( ) { } @ Override public Icon getIcon ( ) { } @ Override public String getTitle ( ) { } No newline ; at end ; of file ; }

Fix:
a . removeAnnotation ( ) ;