I have an GridPane like 3x3. Every cell in the gridpane is a stackpanne which has an imageView inside.
The pane has to rotate left or right, when you click on the cell.
My problem is, when i click on a cell and the image should rotateLeft the Image does not rotate and fit the cell in height and width.
//Code
public void rotateLeft(int x, int y) {
this.paneGameField[x][y].setRotate(-90);
setRotated(this.paneGameField[x][y].getRotate() == -90 ,(ImageView) this.paneGameField[x] [y].getChildren().get(0),this.paneGameField[x][y]);
}
private void setRotated(boolean rotated, ImageView targetNode, Pane parent) {
double angle;
if (rotated) {
angle = 90;
targetNode.fitWidthProperty().bind(parent.heightProperty());
targetNode.fitHeightProperty().bind(parent.widthProperty());
} else {
angle = 0;
targetNode.fitWidthProperty().bind(parent.widthProperty());
targetNode.fitHeightProperty().bind(parent.heightProperty());
}
targetNode.setRotate(angle);
}