I am trying to make a simple game (this is school work) in JavaFX, and I am trying to clear the panel from the board, and then just redraw it. I tried many methods, and this is the only one I found that removes all parts of the board (visually) without creating a visual error that shows a fragment that has already been deleted but is still displayed.
So, I declare gridPaneas follows:
private GridPane gridPecas;
@Override
public void start(Stage primaryStage)
{
gridPecas = new GridPane();
gridPecas.setGridLinesVisible(true);
paintBoard();
}
private void paintBoard()
{
gridPecas.getChildren().clear();
}
The problem with this method is that when "gridPecas.getChildren (). Clear ();" called i'm just losing the grid lines out GridPanel.
How can I solve this problem?
source
share