How to refresh pane in javafx
<p>I recently have been learning JavaFX and have an issue about how to refresh the pane. In this simple program, I want the black square to move to the right into the next block when I am clicking the move button, but it doesn't work, I'm wondering how can I fix my code.</p>

<p><a href="http://i.stack.imgur.com/3DQso.png" rel="nofollow">screen shot</a></p>

<p>Main Class:</p>

<pre><code>public class Main extends Application {
    private Cell cells[] = new Cell[5];
    private Player player;
    private Board board;
    Button move = new Button("move");

    public Main() throws Exception {
        for (int i = 0; i &lt; cells.length; i++) {
            cells[i] = new Cell(i);
        }
        this.player = new Player(0, cells);
        this.board = new Board(player, cells);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        Main game = new Main();
        BorderPane pane = new BorderPane();
        pane.setCenter(board);
        pane.setBottom(move);

        Scene scene = new Scene(pane,400,80);
        primaryStage.setTitle("Move");
        primaryStage.setScene(scene); 
        primaryStage.show();

        move.setOnAction(e -&gt; game.move());
    }
    public void move() {
        player.currentCell.index += 1;
        board.paint();
    }
    public static void main(String[] args) {
        launch(args);
    }
}
</code></pre>

<p>Board class:</p>

<pre><code>class Board extends Pane {
    private Player player;
    public Cell cells[];
    private final int CELLWIDTH = 40;
    private final int CELLHEIGHT = 40;
    private final int LMARGIN = 100;

    public Board(Player p, Cell cells[]) {
        player = p;
        this.cells = cells;
        paint();
    }

    public void paint() {
        Cell cell;
        for (int i=0; i&lt;cells.length; i++) {
            cell = cells[i];
            Rectangle r1 = new Rectangle(xCor(cell.index), 0, CELLWIDTH, CELLHEIGHT); 
            r1.setStroke(Color.BLACK); 
            r1.setFill(Color.WHITE);
            getChildren().add(r1);
        }

        cell = player.currentCell;
        Rectangle r2 = new Rectangle(xCor(cell.index), 0, CELLWIDTH, CELLHEIGHT); 
        r2.setFill(Color.BLACK);
        getChildren().add(r2);
    }
    private int xCor(int col) {
        return LMARGIN + col * CELLWIDTH;
    }
}
</code></pre>

<p>Player Class: </p>

<pre><code>class Player {
    public int position;
    public Cell currentCell;
    public Player(int position, Cell cell[]) throws Exception {
        this.currentCell = cell[0];
    }
}
</code></pre>

<p>Cell Class:</p>

<pre><code>class Cell {
    public int index;
    public Cell(int index) {
        this.index = index;
    }
}
</code></pre>