import javafx.application.Application; 
import javafx.geometry.Insets; 
import javafx.scene.Scene; 
import javafx.scene.control.TextField; 
import javafx.scene.control.ToolBar; 
import javafx.scene.layout.BorderPane; 
import javafx.scene.layout.HBox; 
import javafx.scene.text.Text; 
import javafx.stage.Stage; 
import java.util.concurrent.TimeUnit;

/* 
 * To change this license header, choose License Headers in Project Properties. 
 * To change this template file, choose Tools | Templates 
 * and open the template in the editor. 
 */ 
/** 
 * 
 * @author daniel 
 */ 
public class Perfo extends Application { 

    private BorderPane pane; 

    @Override 
    public void start(Stage primaryStage) throws Exception { 
        pane = new BorderPane(); 
        TextField textField = new TextField("300"); 
        pane.setTop(new ToolBar(textField)); 
        textField.setOnAction(e -> { 
			long startTime = System.nanoTime();
            HBox hbox = new HBox(); 
            int nb = Integer.parseInt(textField.getText()); 
            for (int i = 0; i < nb; i++) { 

                hbox = new HBox(new Text("y"), hbox); 
                final HBox h = hbox; 
                h.setPadding(new Insets(1)); 
            } 
            pane.setCenter(hbox); 
			long endTime = System.nanoTime();
			long timeElapsed = endTime - startTime;
			System.out.println("Execution time in milliseconds: " + timeElapsed / 1000000);

        }); 

        Scene scene = new Scene(pane); 
        primaryStage.setScene(scene); 
        primaryStage.sizeToScene(); 
        primaryStage.show(); 
    } 

    public static void main(String[] args) { 
        launch(args); 
    } 
} 