lucasjoshua #14

Merged
lgc merged 13 commits from lucasjoshua into main 2024-12-15 13:27:15 +00:00
2 changed files with 21 additions and 3 deletions
Showing only changes of commit d3f5421808 - Show all commits

View File

@ -28,7 +28,7 @@ public class BoardDisplay extends JPanel {
this.ships = new ArrayList<>();
this.player = player;
this.gridSize = gridSize;
System.out.println("Name in Boarddisplay: " + player.getName());//Testausgabe
// Erstellung von Spielfeld
for (int i = 0; i <= gridSize; i++) {
for (int j = 0; j <= gridSize; j++) {

View File

@ -23,9 +23,19 @@ public class GameBoard extends JPanel {
ImageIcon gameBoardEmtpy = new ImageIcon("graphics/gameboardempty.png");
ImageIcon gameBoardX = new ImageIcon("graphics/gameboardx.png");
// kontextText Text-Strings
String kT1 = "Bitte Schiffe setzten";
String kT2 = "Warte auf Gegner";
String kT3 = "Du fängst an";
String kT4 = "Dein Gegner fängt an";
String kT5 = "Du bist am Zug";
String kT6 = "Dein Gegner ist am Zug";
String kT7 = "Du hast das Spiel gewonnen";
String kT8 = "Du hast das Spiel verloren";
// Labels
JLabel frameTitle = new JLabel("GameBoard");
JLabel kontextText = new JLabel("Bitte Schiffe setzten");
JLabel kontextText = new JLabel(kT1);
JButton backButton = new JButton(backButtonIcon);
// Eigene ModulButtons
@ -143,6 +153,14 @@ public class GameBoard extends JPanel {
ownBoardPanel.resetAllShips();
}
});
rightPlayerModul7.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
//TODO richtige funktion einfügen
kontextText.setText(kT2);
}
});
// Panel für die Buttons des rechten Spielers (ganz rechts)
//JPanel ownBoardPanel = new JPanel(new GridLayout(gridSize, gridSize));
@ -159,7 +177,7 @@ public class GameBoard extends JPanel {
playerNamesPanel.setLayout(new GridLayout(1, 2)); // Zwei Labels nebeneinander
JLabel player1NameLabel = new JLabel(p1.getName(), SwingConstants.CENTER);
JLabel player2NameLabel = new JLabel(p2.getName(), SwingConstants.CENTER);
System.out.println(player2NameLabel.getText());
System.out.println("Name in Gameboard: " + player1NameLabel.getText());
// Schrift und Formatierung der Labels
player1NameLabel.setFont(new Font("Roboto", Font.BOLD, 18));