ResetButton implementiert
parent
a4c98bc5d9
commit
8f7d815eb5
|
@ -72,9 +72,22 @@ public class GameBoard extends JPanel {
|
|||
}
|
||||
|
||||
public void resetBoard() {
|
||||
board.resetBoard(); // Aufruf der Methode aus HitoriBoard
|
||||
revalidate();
|
||||
repaint();
|
||||
board.resetBoard(); // Logik zurücksetzen
|
||||
removeAll(); // Entferne alle bisherigen Komponenten (Buttons)
|
||||
setLayout(new GridLayout(board.getSize(), board.getSize()));
|
||||
|
||||
// Neue Buttons erstellen und hinzufügen
|
||||
for (int i = 0; i < board.getSize(); i++) {
|
||||
for (int j = 0; j < board.getSize(); j++) {
|
||||
HitoriCell cell = board.getCell(i, j);
|
||||
JButton button = createCellButton(cell, i, j);
|
||||
add(button);
|
||||
}
|
||||
}
|
||||
|
||||
revalidate(); // Layout neu laden
|
||||
repaint(); // Oberfläche neu zeichnen
|
||||
System.out.println("Spielfeld wurde aktualisiert");
|
||||
}
|
||||
|
||||
public boolean validateCurrentBoard() {
|
||||
|
|
Loading…
Reference in New Issue