selectBoard Methode vollständig implementiert
parent
b07fcb0ff5
commit
24100d209b
|
@ -101,8 +101,9 @@ public class StartMenu extends JFrame {
|
|||
HitoriBoard hitoriBoard = new HitoriBoard(boardData, solutionCoordinates); // Stelle sicher, dass die Lösung korrekt geladen wird
|
||||
GameBoard gameBoard = new GameBoard(hitoriBoard);
|
||||
|
||||
loadGameBoard(boardData);
|
||||
//addGameControls(gameBoard);
|
||||
loadGameBoard2(gameBoard, solutionCoordinates);
|
||||
//loadGameBoard(boardData);
|
||||
addGameControls(gameBoard);
|
||||
|
||||
System.out.println("Verfügbare Spielfelder: " + boardFileNames);
|
||||
System.out.println("Ausgewählte Datei: " + selectedFile);
|
||||
|
@ -134,13 +135,13 @@ public class StartMenu extends JFrame {
|
|||
return button;
|
||||
}
|
||||
|
||||
/*private void loadGameBoard(GameBoard gameBoard) {
|
||||
private void loadGameBoard2(GameBoard gameBoard,List<String> solutionCoordinates) {
|
||||
mainPanel.removeAll();
|
||||
mainPanel.setLayout(new BorderLayout());
|
||||
mainPanel.add(gameBoard, BorderLayout.CENTER);
|
||||
mainPanel.revalidate();
|
||||
mainPanel.repaint();
|
||||
}*/
|
||||
}
|
||||
|
||||
private void loadGameBoard(int[][] boardData) {
|
||||
// Neues Panel für das Spielfeld
|
||||
|
@ -155,14 +156,15 @@ public class StartMenu extends JFrame {
|
|||
JPanel controlPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); // Buttons zentriert anordnen
|
||||
|
||||
// "Zurücksetzen"-Button
|
||||
JButton resetButton = new JButton("Zurücksetzen");
|
||||
JButton resetButton = createButton("Zurücksetzen", 200, 30);
|
||||
resetButton.addActionListener(e -> {
|
||||
System.out.println("Reset-Button gedrückt");
|
||||
gameBoard.resetBoard(); // Zurücksetzen des Spielfelds
|
||||
JOptionPane.showMessageDialog(this, "Spielfeld zurückgesetzt!", "Info", JOptionPane.INFORMATION_MESSAGE);
|
||||
//JOptionPane.showMessageDialog(this, "Spielfeld zurückgesetzt!", "Info", JOptionPane.INFORMATION_MESSAGE);
|
||||
});
|
||||
|
||||
// "Validieren"-Button
|
||||
JButton validateButton = new JButton("Validieren");
|
||||
JButton validateButton = createButton("Validieren", 200, 30);
|
||||
validateButton.addActionListener(e -> {
|
||||
boolean isValid = gameBoard.validateCurrentBoard(); // Prüfen, ob das Spielfeld korrekt gelöst ist
|
||||
if (isValid) {
|
||||
|
|
Loading…
Reference in New Issue