|
|
@ -2,8 +2,6 @@ import javax.swing.*;
|
|
|
|
import java.awt.*;
|
|
|
|
import java.awt.*;
|
|
|
|
import java.awt.event.ActionEvent;
|
|
|
|
import java.awt.event.ActionEvent;
|
|
|
|
import java.awt.event.ActionListener;
|
|
|
|
import java.awt.event.ActionListener;
|
|
|
|
import java.awt.event.MouseEvent;
|
|
|
|
|
|
|
|
import java.awt.event.MouseAdapter;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -38,7 +36,7 @@ public class GameBoard extends JPanel {
|
|
|
|
JLabel frameTitle = new JLabel("GameBoard");
|
|
|
|
JLabel frameTitle = new JLabel("GameBoard");
|
|
|
|
JLabel kontextText = new JLabel(kT1);
|
|
|
|
JLabel kontextText = new JLabel(kT1);
|
|
|
|
|
|
|
|
|
|
|
|
JButton backButton = new JButton(backButtonIcon);
|
|
|
|
JButton giveUpButton = new JButton("Aufgeben");
|
|
|
|
// Eigene ModulButtons
|
|
|
|
// Eigene ModulButtons
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -54,7 +52,14 @@ public class GameBoard extends JPanel {
|
|
|
|
buildPanel(frame, semesterCounter);
|
|
|
|
buildPanel(frame, semesterCounter);
|
|
|
|
List<Ship> shipsP1 =p1.getBoard().getShips();
|
|
|
|
List<Ship> shipsP1 =p1.getBoard().getShips();
|
|
|
|
List<Ship> shipsP2 =p2.getBoard().getShips();
|
|
|
|
List<Ship> shipsP2 =p2.getBoard().getShips();
|
|
|
|
backButton.addActionListener(e -> frame.showPanel("MainMenu"));
|
|
|
|
|
|
|
|
|
|
|
|
//TODO Bei aufgeben muss (noch nicht existierende Funktion im Backend aufgerufen werden)
|
|
|
|
|
|
|
|
giveUpButton.addActionListener(new ActionListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
|
|
|
|
frame.showPanel("MainMenu");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* TODO löschen falls nicht gebraucht
|
|
|
|
/* TODO löschen falls nicht gebraucht
|
|
|
|
|
|
|
|
|
|
|
@ -66,7 +71,7 @@ public class GameBoard extends JPanel {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
// Timer für pulsierenden Effekt
|
|
|
|
// Timer für pulsierenden SchwarzGrau-Effekt
|
|
|
|
Timer timer = new Timer(10, new ActionListener() {
|
|
|
|
Timer timer = new Timer(10, new ActionListener() {
|
|
|
|
private int grayValue = 50; // Start-Grauwert (0 = Schwarz, 255 = Weiß)
|
|
|
|
private int grayValue = 50; // Start-Grauwert (0 = Schwarz, 255 = Weiß)
|
|
|
|
private boolean increasing = false; // Richtung des Pulsierens
|
|
|
|
private boolean increasing = false; // Richtung des Pulsierens
|
|
|
@ -130,7 +135,7 @@ public class GameBoard extends JPanel {
|
|
|
|
headerPanel.setLayout(new BorderLayout());
|
|
|
|
headerPanel.setLayout(new BorderLayout());
|
|
|
|
headerPanel.add(kontextText, BorderLayout.WEST);
|
|
|
|
headerPanel.add(kontextText, BorderLayout.WEST);
|
|
|
|
kontextText.setFont(new Font("Roboto", Font.BOLD, 30)); //TODO setFont fixen
|
|
|
|
kontextText.setFont(new Font("Roboto", Font.BOLD, 30)); //TODO setFont fixen
|
|
|
|
headerPanel.add(backButton, BorderLayout.EAST);
|
|
|
|
headerPanel.add(giveUpButton, BorderLayout.EAST);
|
|
|
|
|
|
|
|
|
|
|
|
JPanel leftButtonsPanel = new JPanel();
|
|
|
|
JPanel leftButtonsPanel = new JPanel();
|
|
|
|
leftButtonsPanel.setLayout(new GridLayout(7, 1)); // 6 Buttons untereinander
|
|
|
|
leftButtonsPanel.setLayout(new GridLayout(7, 1)); // 6 Buttons untereinander
|
|
|
@ -172,12 +177,14 @@ public class GameBoard extends JPanel {
|
|
|
|
ownBoardPanel.resetAllShips();
|
|
|
|
ownBoardPanel.resetAllShips();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
//TODO buttons erst nach fertigem setzten ausblenden lassen
|
|
|
|
readyButton.addActionListener(new ActionListener() {
|
|
|
|
readyButton.addActionListener(new ActionListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
|
kontextText.setText(kT2);
|
|
|
|
kontextText.setText(kT2);
|
|
|
|
p1.ready();
|
|
|
|
p1.ready();
|
|
|
|
|
|
|
|
readyButton.setEnabled(false);
|
|
|
|
|
|
|
|
resetButton.setEnabled(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|