Buggy code:
public class MainApp extends Application { private Stage primaryStage ; private AnchorPane rootLayout ; private ArrayList < SubController > controllers ; protected DataFlowController dataflowcontroller ; private ArrayList < Group > groups ; @ FXML private MenuItem newFile ; @ FXML private MenuItem openFile ; @ FXML private MenuItem saveFile ; @ FXML private MenuItem saveFileAs ; @ FXML private MenuItem newScript ; @ FXML private MenuItem openScript ; @ FXML private MenuItem saveScript ; @ FXML private MenuItem saveScriptAs ; @ FXML private MenuItem runScript ; @ FXML private Menu recentFiles ; @ FXML private Menu recentScripts ; @ Override public void start ( Stage ps ) { } public void initRootLayout ( ) { try { FXMLLoader loader = new FXMLLoader ( ) ; loader . setLocation ( this . getClass ( ) . getResource ( "//view//MainView.fxml" ) ) ; loader . setController ( this ) ; rootLayout = ( ( AnchorPane ) ( loader . load ( ) ) ) ; Scene scene = new Scene ( rootLayout ) ; primaryStage . setScene ( scene ) ; primaryStage . show ( ) ; primaryStage . setMaximized ( true ) ; scene . getStylesheets ( ) . add ( this . getClass ( ) . getResource ( "//view//MainStyle.css" ) . toExternalForm ( ) ) ; controllers = new ArrayList < SubController > ( ) ; setView ( "//view//ImportView.fxml" , "importAnchor" ) ; setView ( "//view//SelectView.fxml" , "linkAnchor" ) ; setView ( "//view//SpecifyView.fxml" , "specifyAnchor" ) ; setView ( "//view//ResultsView.fxml" , "resultsAnchor" ) ; setupMenuBar ( ) ; dataflowcontroller = new DataFlowController ( controllers ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } Label noteLabel = ( ( Label ) ( rootLayout . getScene ( ) . lookup ( "#note-label" ) ) ) ; noteLabel . setOnMouseClicked ( ( e ) -> noteLabel . setVisible ( false ) ) ; TabPane tabPane = ( ( TabPane ) ( getRootLayout ( ) . getScene ( ) . lookup ( "#tabPane" ) ) ) ; tabPane . getSelectionModel ( ) . selectedIndexProperty ( ) . addListener ( ( obs , oldV , newV ) -> { if ( ( newV . intValue ( ) ) > ( oldV . intValue ( ) ) ) { int newIdx = newV . intValue ( ) ; int oldIdx = oldV . intValue ( ) ; getPrimaryStage ( ) . getScene ( ) . setCursor ( Cursor . WAIT ) ; Platform . runLater ( new Runnable ( ) { @ Override public void run ( ) { for ( int i = oldIdx ; i <= newIdx ; i ++ ) { if ( i != 0 ) { controllers . get ( i ) . setData ( controllers . get ( ( i - 1 ) ) . getData ( ) ) ; } <START_BUG> if ( ! ( controllers . get ( i ) . validateInput ( true ) ) ) { <END_BUG> tabPane . getSelectionModel ( ) . select ( i ) ; break ; } } getPrimaryStage ( ) . getScene ( ) . setCursor ( Cursor . DEFAULT ) ; } } ) ; } } ) ; } public void changeIcon ( int idx , Boolean status ) { } private void setView ( String viewPath , String fxid ) { } public Stage getPrimaryStage ( ) { } public static void main ( String [ ] args ) { } public ArrayList < Group > getGroups ( ) { } public void setGroups ( final ArrayList < Group > grps ) { } public AnchorPane getRootLayout ( ) { } private void setupMenuBar ( ) { } public void showNotification ( String text , MainApp . NotificationStyle style ) { } public enum NotificationStyle { INFO , WARNING ; } }

Fix:
if ( ( i < newIdx ) && ( ! ( controllers . get ( i ) . validateInput ( true ) ) ) ) {