import javafx.application.Application; 
import javafx.scene.Node; 
import javafx.scene.Scene; 
import javafx.scene.layout.GridPane; 
import javafx.scene.layout.StackPane; 
import javafx.scene.layout.VBox; 
import javafx.scene.text.Text; 
import javafx.stage.Stage; 

public class RowSpanError extends Application { 
    public static void main(String[] args) { 
        launch( args ); 
    } 
     
    private static Node prNode() { 
        VBox ret; 
        final GridPane gp = new GridPane(); 
        gp.setGridLinesVisible( true ); 
         
        
        // 01 
        /*gp.add( new Text( "aaa\nbbb\nccc\nddd\neee" ), 0, 0, 1, 2 ); 
        gp.add( new Text( "aaaa1" ), 1, 0, 1, 1 ); 
        gp.add( new Text( "aaaa2" ), 1, 1, 1, 1 ); */
        
         
        /* 
        // 02 
        gp.add( new Text( "aaa\nbbb\nccc\nddd\neee" ), 0, 0, 1, 2 ); 
        gp.add( new Text( "aaaa1" ), 1, 0, 1, 1 ); 
        gp.add( new Text( "aaaa2" ), 1, 1, 1, 2 ); // '1' -> '2' 
        */ 
         
        // 03 
        // if we set rowspan=4 or 2 we'll get another result 
        /*gp.add( new Text( "aaa\nbbb\nccc\nddd\neee" ), 0, 0, 1, 3 ); 
        gp.add( new Text( "aaaa1" ), 1, 0, 1, 1 ); 
        gp.add( new Text( "aaaa2" ), 1, 1, 1, 2 );*/
         
         
         
        // 04 
        gp.add( new Text( "aaa\nbbb\nccc\nddd\neee" ), 0, 0, 1, 3 ); 
        gp.add( new Text( "aaaa1" ), 1, 0, 1, 1 ); 
        gp.add( new Text( "aaaa2" ), 1, 1, 1, 2 ); 
        gp.add( new Text( "xxx11" ), 2, 0, 1, 1 ); 
        gp.add( new Text( "xxx21" ), 2, 1, 1, 1 ); 
        gp.add( new Text( "xxx22" ), 2, 2, 1, 1 ); 
        
         
        ret = new VBox( 8, new Text( "text1" ), gp, new Text( "text2" ) ); 
         
        return ret; 
    } 
     
    @Override 
    public void start(Stage stage) { 
        final StackPane root = new StackPane(); 
        root.getChildren().add( prNode() ); 
         
        final Scene scene = new Scene( root, 300, 250 ); 
         
        stage.setTitle( "Hello World!" ); 
        stage.setScene( scene ); 
        stage.show(); 
    } 
} 