diff --git a/schach/src/main/java/de/hs_mannheim/informatik/chess/view/GameGui.java b/schach/src/main/java/de/hs_mannheim/informatik/chess/view/GameGui.java index 76f4b97..5dfe8ef 100644 --- a/schach/src/main/java/de/hs_mannheim/informatik/chess/view/GameGui.java +++ b/schach/src/main/java/de/hs_mannheim/informatik/chess/view/GameGui.java @@ -112,7 +112,7 @@ public class GameGui { } else { label.setBackground(new Color(0xe0e1dd)); } - fields[row][col] = label; // <-- Save the label + fields[row][col] = label; boardPanel.add(label); } @@ -158,7 +158,7 @@ public class GameGui { JPanel statsPanel = new JPanel(new BorderLayout()); statsPanel.setBackground(new Color(0x0d1b2a)); - // Move-Liste (scrollbar, wie gehabt) + // Move-Liste moveListPanel = new JPanel(); moveListPanel.setLayout(new BoxLayout(moveListPanel, BoxLayout.Y_AXIS)); moveListPanel.setBackground(new Color(0x0d1b2a)); @@ -169,7 +169,7 @@ public class GameGui { // Button-Leiste JPanel buttonPanel = new JPanel(); buttonPanel.setBackground(new Color(0x0d1b2a)); - // Grid oder Flow – je nach Geschmack + // Grid oder Flow buttonPanel.setLayout(new GridLayout(1, 4, 10, 0)); // Style (optional) @@ -190,6 +190,24 @@ public class GameGui { return statsPanel; } + public String showPromotionDialog(String color) { + String[] choices = {"Dame", "Turm", "Springer", "Läufer"}; + String choice = (String) JOptionPane.showInputDialog( + null, + color + "er Bauer wird umgewandelt – wähle Figur:", + "Bauernumwandlung", + JOptionPane.PLAIN_MESSAGE, + null, + choices, + choices[0]); + if (choice == null) return "QUEEN"; + switch (choice) { + case "Turm": return "ROOK"; + case "Springer": return "KNIGHT"; + case "Läufer": return "BISHOP"; + default: return "QUEEN"; + } + } public void updateMoveList(List moves) { moveListPanel.removeAll();