Buggy code:
@ FXML private TextField txtAccountAdd ; @ FXML private Button bSearchAccount ; @ FXML private ListView < Account > listAccountAdd ; @ FXML private Button bAccountAdd ; @ FXML private Button bAddAccountClose ; private Account account ; private Stage dialogStage ; @ Override public void update ( UpdateType type ) { } @ Override public void initialize ( URL location , ResourceBundle resources ) { } private void updateCategory ( Category rootCategory ) { } private void updateCategoryRec ( Category category , TreeItem < Category > item ) { } private void updateLocation ( List < Location > list ) { } private void createPopUp ( String path , String title , Account selectedAccount ) { } public void setCurrentStage ( Stage stage ) { } public void setAccount ( Account account ) { } private class MyActionEventHandler implements EventHandler < ActionEvent > { @ Override public void handle ( ActionEvent event ) { } } private class MyEventHandler implements EventHandler < Event > { @ Override public void handle ( Event event ) { System . out . println ( ( "kontroller:" + ( event . getSource ( ) ) ) ) ; if ( event . getSource ( ) . equals ( txtAccountSearch ) ) { String input = txtAccountSearch . getText ( ) ; listAccount . getItems ( ) . clear ( ) ; for ( Account a : superController . getAccounts ( input ) ) { listAccount . getItems ( ) . add ( a ) ; } } if ( event . getSource ( ) . equals ( bWeiterLocation ) ) { Account selectedAccount = listAccount . getSelectionModel ( ) . getSelectedItem ( ) ; if ( selectedAccount == null ) { lbInfo . setText ( "Kein<seq2seq4repair_space>Account<seq2seq4repair_space>ausgewählt" ) ; return ; } System . out . println ( selectedAccount . getName ( ) ) ; dialogStage . close ( ) ; createPopUp ( "LocationSelect.fxml" , "Location<seq2seq4repair_space>auswählen" , selectedAccount ) ; } if ( event . getSource ( ) . equals ( bWeiter ) ) { Account selectedAccount = listAccount . getSelectionModel ( ) . getSelectedItem ( ) ; if ( selectedAccount == null ) { lbInfo . setText ( "Kein<seq2seq4repair_space>Account<seq2seq4repair_space>ausgewählt" ) ; return ; } System . out . println ( selectedAccount . getName ( ) ) ; dialogStage . close ( ) ; createPopUp ( "CatSelect.fxml" , "Kategorie<seq2seq4repair_space>auswählen" , selectedAccount ) ; } if ( event . getSource ( ) . equals ( txtCatSearch ) ) { String input = txtCatSearch . getText ( ) ; System . out . println ( input ) ; updateCategory ( superController . getCategoryRoot ( input ) ) ; } if ( event . getSource ( ) . equals ( trvCat ) ) { Category cat = trvCat . getSelectionModel ( ) . getSelectedItem ( ) . getValue ( ) ; if ( ! ( listCat . getItems ( ) . contains ( cat ) ) ) { listCat . getItems ( ) . add ( cat ) ; } } if ( event . getSource ( ) . equals ( bEntf ) ) { int index = listCat . getSelectionModel ( ) . getSelectedIndex ( ) ; System . out . println ( index ) ; if ( index >= 0 ) { listCat . getItems ( ) . remove ( index ) ; listCat . setItems ( listCat . getItems ( ) ) ; } } if ( event . getSource ( ) . equals ( bFertig ) ) { System . out . println ( "bFertig<seq2seq4repair_space>xxxx" ) ; for ( Category cat : listCat . getItems ( ) ) { superController . setCategory ( account . getId ( ) , cat . getId ( ) ) ; } dialogStage . close ( ) ; } if ( event . getSource ( ) . equals ( bZurueck ) ) { dialogStage . close ( ) ; createPopUp ( "AccountSelect.fxml" , "Account<seq2seq4repair_space>auswählen" , null ) ; } if ( event . getSource ( ) . equals ( bZurueckLocation ) ) { dialogStage . close ( ) ; createPopUp ( "AccountSelectLocation.fxml" , "Account<seq2seq4repair_space>auswählen" , null ) ; } if ( event . getSource ( ) . equals ( txtLocSearch ) ) { String input = txtLocSearch . getText ( ) ; System . out . println ( input ) ; updateLocation ( superController . getLocations ( input ) ) ; } if ( event . getSource ( ) . equals ( bFertigLocation ) ) { TreeItem < Location > selectedItem = trvLocation . getSelectionModel ( ) . getSelectedItem ( ) ; if ( selectedItem == null ) { return ; } if ( ( account ) == null ) { System . out . println ( "an<seq2seq4repair_space>error<seq2seq4repair_space>occured!" ) ; return ; } superController . setLocation ( account . getId ( ) , selectedItem . getValue ( ) . getId ( ) ) ; dialogStage . close ( ) ; } if ( event . getSource ( ) . equals ( bSearchAccount ) ) { String input = txtAccountAdd . getText ( ) ; if ( ( input == null ) || ( input . equals ( "" ) ) ) { return ; } listAccountAdd . getItems ( ) . clear ( ) ; List < User > list = TwitterAccess . getUser ( input ) ; Iterator < User > it = list . iterator ( ) ; while ( it . hasNext ( ) ) { <START_BUG> Account account = new Account ( 0 , it . next ( ) . getName ( ) , null ) ; <END_BUG> listAccountAdd . getItems ( ) . add ( account ) ; } } if ( event . getSource ( ) . equals ( bAccountAdd ) ) { listAccountAdd . getSelectionModel ( ) . getSelectedItem ( ) ; } if ( event . getSource ( ) . equals ( bAddAccountClose ) ) { dialogStage . close ( ) ; } } } }

Fix:
Account account = new Account ( 0 , it . next ( ) . getName ( ) , "" ) ;