package org.mystic.kagan;

import javafx.fxml.FXML;
import javafx.scene.Group;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;


public class Controller {

    private static final String TRAINING_SESSION_PATH = "/compare/training-session";
    private static final String MAIN_SESSION_PATH = "/compare/main-session";
    @FXML
    Group rootGroup;
    @FXML
    Button startTestButton;
    @FXML
    TextArea instructionText;

    @FXML
    private void closeWindow() {
        System.out.println(rootGroup.getChildren().size());
        System.exit(0);
    }

    private final double[] x = {294, 14, 190, 366, 537, 14, 190, 366, 537};
    private final double[] y = {25, 185, 185, 185, 185, 367, 367, 367, 367};

    @FXML
    private void startKaganTest() {
        startTestButton.setDisable(true);
        instructionText.setVisible(false);
        for (int i = 0; i <= 8; ++i) {
            final String url = Controller.class.getResource(TRAINING_SESSION_PATH + "/1/" + i + ".jpg").toString();
            ImageView sample3 = new ImageView(new Image(url));
            sample3.setLayoutX(x[i]);
            sample3.setLayoutY(y[i]);
            sample3.setFitWidth(200);
            sample3.setFitHeight(150);
            sample3.setPreserveRatio(true);
            sample3.setPickOnBounds(true);
            rootGroup.getChildren().add(sample3);
        }
    }
}
@@ -22,16 +22,51 @@
 gan;%0D%0A%0D%0A
+import javafx.event.EventHandler;%0D%0A
 import j
@@ -259,16 +259,55 @@
 eView;%0D%0A
+import javafx.scene.input.MouseEvent;%0D%0A
 %0D%0A%0D%0Apubl
@@ -1223,23 +1223,25 @@
 ageView 
-sample3
+imageView
  = new I
@@ -1271,39 +1271,41 @@
 );%0D%0A            
-sample3
+imageView
 .setLayoutX(x%5Bi%5D
@@ -1316,31 +1316,33 @@
             
-sample3
+imageView
 .setLayoutY(
@@ -1357,31 +1357,33 @@
             
-sample3
+imageView
 .setFitWidth
@@ -1398,31 +1398,33 @@
             
-sample3
+imageView
 .setFitHeigh
@@ -1440,31 +1440,33 @@
             
-sample3
+imageView
 .setPreserve
@@ -1491,23 +1491,25 @@
         
-sample3
+imageView
 .setPick
@@ -1517,32 +1517,326 @@
 nBounds(true);%0D%0A
+            imageView.setOnMouseClicked(new EventHandler%3CMouseEvent%3E() %7B%0D%0A                @Override%0D%0A                public void handle(MouseEvent mouseEvent) %7B%0D%0A                    System.out.println(mouseEvent.getSceneX() + %22 %22 + mouseEvent.getSceneY());%0D%0A                %7D%0D%0A            %7D);%0D%0A
             root
@@ -1863,15 +1863,17 @@
 add(
-sample3
+imageView
 );%0D%0A

Add mouse click handling