New method showPromotionDialog in GameGui
parent
3e1a770176
commit
f72883710f
|
|
@ -112,7 +112,7 @@ public class GameGui {
|
||||||
} else {
|
} else {
|
||||||
label.setBackground(new Color(0xe0e1dd));
|
label.setBackground(new Color(0xe0e1dd));
|
||||||
}
|
}
|
||||||
fields[row][col] = label; // <-- Save the label
|
fields[row][col] = label;
|
||||||
boardPanel.add(label);
|
boardPanel.add(label);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -158,7 +158,7 @@ public class GameGui {
|
||||||
JPanel statsPanel = new JPanel(new BorderLayout());
|
JPanel statsPanel = new JPanel(new BorderLayout());
|
||||||
statsPanel.setBackground(new Color(0x0d1b2a));
|
statsPanel.setBackground(new Color(0x0d1b2a));
|
||||||
|
|
||||||
// Move-Liste (scrollbar, wie gehabt)
|
// Move-Liste
|
||||||
moveListPanel = new JPanel();
|
moveListPanel = new JPanel();
|
||||||
moveListPanel.setLayout(new BoxLayout(moveListPanel, BoxLayout.Y_AXIS));
|
moveListPanel.setLayout(new BoxLayout(moveListPanel, BoxLayout.Y_AXIS));
|
||||||
moveListPanel.setBackground(new Color(0x0d1b2a));
|
moveListPanel.setBackground(new Color(0x0d1b2a));
|
||||||
|
|
@ -169,7 +169,7 @@ public class GameGui {
|
||||||
// Button-Leiste
|
// Button-Leiste
|
||||||
JPanel buttonPanel = new JPanel();
|
JPanel buttonPanel = new JPanel();
|
||||||
buttonPanel.setBackground(new Color(0x0d1b2a));
|
buttonPanel.setBackground(new Color(0x0d1b2a));
|
||||||
// Grid oder Flow – je nach Geschmack
|
// Grid oder Flow
|
||||||
buttonPanel.setLayout(new GridLayout(1, 4, 10, 0));
|
buttonPanel.setLayout(new GridLayout(1, 4, 10, 0));
|
||||||
|
|
||||||
// Style (optional)
|
// Style (optional)
|
||||||
|
|
@ -190,6 +190,24 @@ public class GameGui {
|
||||||
return statsPanel;
|
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) {
|
public void updateMoveList(List<String> moves) {
|
||||||
moveListPanel.removeAll();
|
moveListPanel.removeAll();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue