private TilePane selectedTilePane; private TilePane currentTilePane; private ImageView selectedImageView; void onMouseClicked(MouseEvent event) { this.resetTileBackgroundColor(); this.selectedImageView = (ImageView) event.getSource(); this.selectedTilePane = (TilePane) this.selectedImageView.getParent(); this.selectedTilePane.setStyle("-fx-background-color:gray"); } void onMouseEntered(MouseEvent event) { this.currentTilePane = (TilePane) event.getSource(); if (!this.currentTilePane.equals(this.selectedTilePane)) { this.currentTilePane.setStyle("-fx-background-color:lightgray"); } } void onMouseExited(MouseEvent event) { this.currentTilePane = (TilePane) event.getSource(); if (!this.currentTilePane.equals(this.selectedTilePane)) { this.currentTilePane.setStyle("-fx-background-color:whitesmoke"); } } private void resetTileBackgroundColor() { tilePane<XXXXX>.setStyle("-fx-background-color:whitesmoke"); }