New method showPromotionDialog in GameGui
parent
3e1a770176
commit
f72883710f
|
@ -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<String> moves) {
|
||||
moveListPanel.removeAll();
|
||||
|
|
Loading…
Reference in New Issue