What you're doing in your code is swapping. In a regular chess game, you never need to swap. Just replace
tmp=board[fromRow][fromCol]; // don't need this
board[toRow][toCol]=tmp; // don't need this
board[fromRow][fromCol]=new Gamepiece(); // don't need this
Just do:
board[toRow][toCol] = board[fromRow][fromCol];
board[fromRow][fromCol] = null
This is all considering your board is a 2D array of ChessPiece
s, for example ChessPiece[][] board = new ChessPiece[8][8];
I don't know if this will solve your problem, without seeing more code, but I was just point this out.