I'm trying to create a chess game using JavaFX and I found making the match history quite tricky, after succesful print of the history I'm trying to add posibility to go back to some board state.
I tried this way, but it wouldn't work: The first part is a snippet from my controller Initialize function
table.setRowFactory( tv -> { TableRow<Move> move = new TableRow<Move>(); move.setOnMouseClicked(event -> { if(event.getClickCount()==2 && !move.isEmpty()) setBoardTo(move.getItem()); else System.out.println("kek"); }); return move; }); Then we have the function that we go in(it works), but even after changing the board to another and redrawing it, it looks the same way.
private void setBoardTo(Move move){ System.out.println(move.boardState.toString()); System.out.println(board.toString()); board.setBoard(move.boardState); board.draw(); } Function in Board class that I am using to assign values.
public void setBoard(Board another){ this.boardFigures = another.boardFigures; this.highlightedFields = another.highlightedFields; this.hasHighlightedFields = another.hasHighlightedFields; } The last part is just a snippet from my Move class(it contains information about moves but i cut it off so the code would look more clean)
public class Move { private static int globalID=0; public int ID; final Board boardState; public Move(Board board){ ID=globalID++; boardState = new Board(board);} What am I doing wrong? If anything else is needed, I'll try to paste it as soon as possible.
thanks,roiek