JavaFXで簡単なゲーム(学校の作品)を作成しようとしています。ボードでパネルをクリアしてから、塗り直します。私は多くの方法を試しましたが、これは、すでに削除されているがまだ表示されている部分を示す視覚的なバグを作成せずに、ボードのすべての部分を(視覚的に)削除する唯一の方法です。
だから私はこのように宣言しgridPane
ます:
private GridPane gridPecas;
@Override
public void start(Stage primaryStage)
{
gridPecas = new GridPane();
gridPecas.setGridLinesVisible(true);
paintBoard();
// rest of the code to create and paint the Stage
}
private void paintBoard()
{
gridPecas.getChildren().clear();
// Code to fill the board with ImageView and Images of the pieces
}
このメソッドの問題は、「gridPecas.getChildren()。clear();」の場合です。と呼ばれます。からグリッド線を緩めるだけGridPanel
です。
どうすればこの問題を解決できますか?