lucasjoshua #14
|
@ -92,6 +92,15 @@ public class BoardDisplay extends JPanel {
|
|||
this.currentShip = ship;
|
||||
}
|
||||
|
||||
public void resetAllShips() {
|
||||
ships.clear();
|
||||
this.currentShip = null;
|
||||
for(int i = 0; i < gridSize; i++) {
|
||||
for(int j = 0; j < gridSize; j++) {
|
||||
fields[i][j].setBackground(Color.BLUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* TODO Funktion beschreiben etc.
|
||||
* @param ship
|
||||
|
|
|
@ -136,6 +136,13 @@ public class GameBoard extends JPanel {
|
|||
JToggleButton leftPlayerModul7 = new JToggleButton("Reset");
|
||||
leftPlayerModul7.setBackground(Color.RED);
|
||||
leftButtonsPanel.add(leftPlayerModul7);
|
||||
|
||||
leftPlayerModul7.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ownBoardPanel.resetAllShips();
|
||||
}
|
||||
});
|
||||
// Panel für die Buttons des rechten Spielers (ganz rechts)
|
||||
|
||||
//JPanel ownBoardPanel = new JPanel(new GridLayout(gridSize, gridSize));
|
||||
|
|
Loading…
Reference in New Issue