23 lines
625 B
Java
23 lines
625 B
Java
|
import javax.swing.*;
|
||
|
import java.awt.event.*;
|
||
|
|
||
|
public class Reset implements ActionListener {
|
||
|
private int[][] grid;
|
||
|
private Enter enterPanel;
|
||
|
|
||
|
public Reset(int[][] grid, Enter enterPanel) {
|
||
|
this.grid = grid;
|
||
|
this.enterPanel = enterPanel;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void actionPerformed(ActionEvent e) {
|
||
|
// Réinitialiser la grille en copiant la grille initiale
|
||
|
for (int i = 0; i < grid.length; i++) {
|
||
|
System.arraycopy(enterPanel.getInitialGrid()[i], 0, grid[i], 0, grid[i].length);
|
||
|
}
|
||
|
// Redessiner le panneau
|
||
|
enterPanel.repaint();
|
||
|
}
|
||
|
}
|