Basic implementation of the A* algorithm in java swing