diff --git a/PR2Projekt/src/de/hs_mannheim/informatik/pr2projekt/gui/GameGUI.java b/PR2Projekt/src/de/hs_mannheim/informatik/pr2projekt/gui/GameGUI.java index 0029561..59cc330 100644 --- a/PR2Projekt/src/de/hs_mannheim/informatik/pr2projekt/gui/GameGUI.java +++ b/PR2Projekt/src/de/hs_mannheim/informatik/pr2projekt/gui/GameGUI.java @@ -14,7 +14,8 @@ import javax.swing.JPanel; import de.hs_mannheim.informatik.pr2projekt.domain.HitoriMain; public class GameGUI { - private static void paintGame(String[] filepath, JButton[][] buttons, String[][] colors, Stack madeMoves, String[][] data){ + + public static void paintGame(String[] filepath, JButton[][] buttons, String[][] colors, Stack madeMoves, String[][] data){ JFrame frame = new JFrame(); int num = buttons.length; JPanel gameGrid = new JPanel(new GridLayout(num,num,0,0)); @@ -40,9 +41,9 @@ public class GameGUI { MenuGUI.getPath(filepath); }); JButton b1 = new JButton("Zurück"); - b1.addActionListener(e -> {backOneStep(madeMoves, buttons, colors,gameGrid);}); + b1.addActionListener(e -> {HitoriMain.backOneStep(madeMoves, buttons, colors, gameGrid);}); JButton b2 = new JButton("Zurücksetzen"); - b2.addActionListener(e -> {totalResetButton(buttons, colors, madeMoves, data);}); + b2.addActionListener(e -> {HitoriMain.totalResetButton(buttons, colors, madeMoves, data);}); JButton b3 = new JButton("Abgeben"); String path = filepath[0]; b3.addActionListener(e -> { @@ -69,7 +70,7 @@ public class GameGUI { frame.setSize(600,600); } - private static void paintButton(JButton b, String[] pos, String[][] colors, Stack madeMoves){ + public static void paintButton(JButton b, String[] pos, String[][] colors, Stack madeMoves){ int i = Integer.parseInt(pos[0]); int j = Integer.parseInt(pos[1]); String col = colors[Integer.parseInt(pos[0])][Integer.parseInt(pos[1])]; @@ -106,5 +107,18 @@ public class GameGUI { String logEntrance = i+"."+j+"."+"W"; madeMoves.push(logEntrance); } + + public static void gridUpdate(JPanel grid, JButton[][] buttons){ + grid.removeAll(); + grid.repaint(); + for(int i = 0; i