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 bef0c28..0029561 100644 --- a/PR2Projekt/src/de/hs_mannheim/informatik/pr2projekt/gui/GameGUI.java +++ b/PR2Projekt/src/de/hs_mannheim/informatik/pr2projekt/gui/GameGUI.java @@ -4,6 +4,7 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.GridLayout; import java.io.FileNotFoundException; +import java.util.Stack; import javax.swing.JButton; import javax.swing.JFrame; @@ -67,4 +68,43 @@ public class GameGUI { frame.setVisible(true); frame.setSize(600,600); } + + private 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])]; + if(col.endsWith("W")){ + b.setOpaque(true); + b.setForeground(Color.BLACK); + b.setContentAreaFilled(true); + b.setBorderPainted(false); + b.setFocusPainted(false); + b.setBackground(Color.lightGray); + colors[i][j] += "G"; + String logEntrance = i+"."+j+"."+"G"; + madeMoves.push(logEntrance); + } + if(col.endsWith("G")){ + b.setOpaque(true); + b.setForeground(Color.WHITE); + b.setContentAreaFilled(true); + b.setBorderPainted(false); + b.setFocusPainted(false); + b.setBackground(Color.BLACK); + colors[i][j] += "B"; + String logEntrance = i+"."+j+"."+"B"; + madeMoves.push(logEntrance); + } + if(col.endsWith("B")){ + b.setOpaque(true); + b.setForeground(Color.BLACK); + b.setContentAreaFilled(true); + b.setBorderPainted(false); + b.setFocusPainted(false); + b.setBackground(Color.WHITE); + colors[i][j] += "W"; + String logEntrance = i+"."+j+"."+"W"; + madeMoves.push(logEntrance); + } + } }