Bild durch mausklick ersetzen was mache ich falsch ?


Karl7777

Grünschnabel
Code:
package application;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.text.Text;
public class MemoryController implements Initializable {
@FXML
AnchorPane flaeche;
@FXML
Text spieler1;
@FXML
Text spieler2;
@FXML
Text reihe;
@FXML
ImageView bild0;
@FXML
ImageView bild1;
@FXML
ImageView bild2;
@FXML
ImageView bild3;
@FXML
ImageView bild4;
@FXML
ImageView bild5;
@FXML
ImageView bild6;
@FXML
ImageView bild7;

@FXML
ImageView bild8;
@FXML
ImageView bild9;
@FXML
ImageView bild10;
@FXML
ImageView bild11;
@FXML
ImageView bild12;
@FXML
ImageView bild13;
@FXML
ImageView bild14;
@FXML
ImageView bild15;
//private MemoryModel dasSpiel = null;
//private void kartenAktualisieren() {

//}
public void handleBild(MouseEvent event) {
reihe.setText("Prog II");
Image bild=new Image("file:///Fertige/Kaktus.png");
bild0.setImage(bild);
}
@Override
public void initialize(URL url, ResourceBundle rb) {
//reihe.setText("");
//bild0.setOnMouseClicked(this::handleBild);
bild0.setOnMouseClicked(e -> handleBild(e));
//dasSpiel = new MemoryModel();
}

}

}