Buggy code:
@ SuppressWarnings ( "serial" ) public class RefactorMenu extends JMenu { private JMenuItem minimise ; private JMenuItem removeUnreachable ; private JMenuItem duplicate ; private JMenuItem nfaToDfa ; private ModeMenu modeMenu ; public RefactorMenu ( String title , ArrayList < MyJUNGCanvas > modelList , JTabbedPane tabbedPane , ModeMenu modeMenu ) { } private class AlgorithmListener implements ActionListener { ArrayList < MyJUNGCanvas > modelList ; JTabbedPane tabbedPane ; public AlgorithmListener ( ArrayList < MyJUNGCanvas > modelList , JTabbedPane tabbedPane ) { } @ Override public void actionPerformed ( ActionEvent e ) { if ( e . getSource ( ) . equals ( minimise ) ) { if ( ! ( Algorithms . isDFA ( modelList . get ( tabbedPane . getSelectedIndex ( ) ) . getModel ( ) ) ) ) { <START_BUG> JOptionPane . showMessageDialog ( tabbedPane . getRootPane ( ) , "Your<seq2seq4repair_space>model<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>an<seq2seq4repair_space>NFA" ) ; <END_BUG> return ; } String title = modelList . get ( tabbedPane . getSelectedIndex ( ) ) . getTitle ( ) ; Algorithms . copyActive ( modelList , tabbedPane , modeMenu ) ; VisualizationViewer < Vertex , Edge > vv = modelList . get ( tabbedPane . getSelectedIndex ( ) ) . getVisualizationViewer ( ) ; vv . setGraphLayout ( new edu . uci . ics . jung . algorithms . layout . KKLayout < Vertex , Edge > ( vv . getGraphLayout ( ) . getGraph ( ) ) ) ; Algorithms . minimise ( modelList . get ( tabbedPane . getSelectedIndex ( ) ) . getModel ( ) ) ; modelList . get ( tabbedPane . getSelectedIndex ( ) ) . getVisualizationViewer ( ) . repaint ( ) ; modelList . get ( tabbedPane . getSelectedIndex ( ) ) . setTitle ( ( "min<seq2seq4repair_space>" + title ) ) ; } else if ( e . getSource ( ) . equals ( removeUnreachable ) ) { Algorithms . removeUnreachable ( modelList . get ( tabbedPane . getSelectedIndex ( ) ) . getModel ( ) ) ; modelList . get ( tabbedPane . getSelectedIndex ( ) ) . getVisualizationViewer ( ) . repaint ( ) ; } else if ( e . getSource ( ) . equals ( duplicate ) ) { Algorithms . copyActive ( modelList , tabbedPane , modeMenu ) ; VisualizationViewer < Vertex , Edge > vv = modelList . get ( tabbedPane . getSelectedIndex ( ) ) . getVisualizationViewer ( ) ; vv . setGraphLayout ( new edu . uci . ics . jung . algorithms . layout . KKLayout < Vertex , Edge > ( vv . getGraphLayout ( ) . getGraph ( ) ) ) ; modelList . get ( tabbedPane . getSelectedIndex ( ) ) . getVisualizationViewer ( ) . repaint ( ) ; } else if ( e . getSource ( ) . equals ( nfaToDfa ) ) { Model dfa = Algorithms . nfaToDfa ( modelList . get ( tabbedPane . getSelectedIndex ( ) ) . getModel ( ) ) ; if ( dfa != null ) { MyJUNGCanvas nCanvas = new MyJUNGCanvas ( dfa ) ; nCanvas . setTitle ( String . format ( "%s<seq2seq4repair_space>to<seq2seq4repair_space>DFA" , modelList . get ( tabbedPane . getSelectedIndex ( ) ) . getTitle ( ) ) ) ; nCanvas . initialise ( modeMenu . getMode ( ) ) ; modelList . add ( nCanvas ) ; tabbedPane . add ( nCanvas . getTitle ( ) , nCanvas . getVisualizationViewer ( ) ) ; tabbedPane . setSelectedIndex ( ( ( tabbedPane . getTabCount ( ) ) - 1 ) ) ; VisualizationViewer < Vertex , Edge > vv = modelList . get ( tabbedPane . getSelectedIndex ( ) ) . getVisualizationViewer ( ) ; vv . setGraphLayout ( new edu . uci . ics . jung . algorithms . layout . KKLayout < Vertex , Edge > ( vv . getGraphLayout ( ) . getGraph ( ) ) ) ; nCanvas . getVisualizationViewer ( ) . repaint ( ) ; } } } } }

Fix:
JOptionPane . showMessageDialog ( tabbedPane . getRootPane ( ) , "Your<seq2seq4repair_space>model<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>a<seq2seq4repair_space>DFA" ) ;