From 73768473e15a66e2edbda2ee2f3ebee5f51f77cd Mon Sep 17 00:00:00 2001 From: dstuck Date: Wed, 25 Jun 2025 04:11:06 +0200 Subject: [PATCH] fix merge conflict --- .../de/mannheim/th/chess/ui/SpielFrame.java | 134 ++++++------------ 1 file changed, 47 insertions(+), 87 deletions(-) diff --git a/src/main/java/de/mannheim/th/chess/ui/SpielFrame.java b/src/main/java/de/mannheim/th/chess/ui/SpielFrame.java index 445c4ce..b0a7d80 100644 --- a/src/main/java/de/mannheim/th/chess/ui/SpielFrame.java +++ b/src/main/java/de/mannheim/th/chess/ui/SpielFrame.java @@ -225,10 +225,10 @@ public class SpielFrame extends JFrame { this.setDefaultBackground(); } - /* - * Switches the button actions depending on the boardmode - */ - private void setButtonsActions() { + /* + * Switches the button actions depending on the boardmode + */ + public void setButtonsActions() { List selectables; @@ -272,10 +272,10 @@ public class SpielFrame extends JFrame { } - for (JButton b : buttons) { - panelLinks.add(b); - } - } + for (JButton b : buttons) { + panelLinks.add(b); + } + } public void showWin(int player) { JFrame frame = new JFrame("Result"); @@ -283,20 +283,20 @@ public class SpielFrame extends JFrame { frame.setSize(300, 150); frame.setLayout(null); - JLabel jl = new JLabel(String.format("%d - %d", player / 2, player % 2)); - jl.setBounds(50, 30, 200, 25); - jl.setFont(new Font("Tahoma", Font.BOLD, 20)); - frame.add(jl); - frame.setVisible(true); - } - - public void showResult(String res) { - - ausgabe.setFont(new Font("Calibri", Font.BOLD, 40)); - ausgabe.setForeground(new Color(178, 34, 34)); - ausgabe.setText(" "+res); - - } + JLabel jl = new JLabel(String.format("%d - %d", player / 2, player % 2)); + jl.setBounds(50, 30, 200, 25); + jl.setFont(new Font("Tahoma", Font.BOLD, 20)); + frame.add(jl); + frame.setVisible(true); + } + + public void showResult(String res) { + + ausgabe.setFont(new Font("Calibri", Font.BOLD, 40)); + ausgabe.setForeground(new Color(178, 34, 34)); + ausgabe.setText(" " + res); + + } public int showPromotion() { final int[] result = { -1 }; @@ -416,14 +416,14 @@ public class SpielFrame extends JFrame { aufgebenUndo.add(Box.createHorizontalStrut(10)); - aufgeben2 = new JButton("Aufgeben"); - aufgeben2.setBackground(Color.LIGHT_GRAY); - aufgeben2.setForeground(Color.BLACK); - aufgeben2.setFont(new Font("Tahoma", Font.BOLD, 16)); - aufgeben2.setAlignmentX(Component.CENTER_ALIGNMENT); - - aufgeben2.addActionListener(new ButtonAufgebenListener(this, this.game)); - aufgebenUndo.add(aufgeben2); + aufgeben2 = new JButton("Aufgeben"); + aufgeben2.setBackground(Color.LIGHT_GRAY); + aufgeben2.setForeground(Color.BLACK); + aufgeben2.setFont(new Font("Tahoma", Font.BOLD, 16)); + aufgeben2.setAlignmentX(Component.CENTER_ALIGNMENT); + + aufgeben2.addActionListener(new ButtonAufgebenListener(this, this.game)); + aufgebenUndo.add(aufgeben2); aufgebenUndo.add(Box.createHorizontalStrut(10)); @@ -524,14 +524,14 @@ public class SpielFrame extends JFrame { aufgebenUndo.add(Box.createHorizontalStrut(10)); - aufgeben = new JButton("Aufgeben"); - aufgeben.setBackground(Color.LIGHT_GRAY); - aufgeben.setForeground(Color.BLACK); - aufgeben.setFont(new Font("Tahoma", Font.BOLD, 16)); - aufgeben.setAlignmentX(Component.CENTER_ALIGNMENT); - aufgeben.addActionListener(new ButtonAufgebenListener(this, this.game)); - - aufgebenUndo.add(aufgeben); + aufgeben = new JButton("Aufgeben"); + aufgeben.setBackground(Color.LIGHT_GRAY); + aufgeben.setForeground(Color.BLACK); + aufgeben.setFont(new Font("Tahoma", Font.BOLD, 16)); + aufgeben.setAlignmentX(Component.CENTER_ALIGNMENT); + aufgeben.addActionListener(new ButtonAufgebenListener(this, this.game)); + + aufgebenUndo.add(aufgeben); aufgebenUndo.add(Box.createHorizontalStrut(10)); @@ -616,60 +616,20 @@ public class SpielFrame extends JFrame { } } - public JButton getAufgeben() { - return aufgeben; - } - - public void setAufgeben(JButton aufgeben) { - this.aufgeben = aufgeben; - } - - public JButton getAufgeben2() { - return aufgeben2; - } - - public void setAufgeben2(JButton aufgeben2) { - this.aufgeben2 = aufgeben2; - } - - public void setMode(BoardMode mode) { - this.mode = mode; + public JButton getAufgeben() { + return aufgeben; } - /** - * Inverts the Enabled property of the controlpanelButtons - */ - public void enableControlPanelButtons() { - for (Component c : this.controlPanel.getComponents()) { - if (c instanceof JButton) { - c.setEnabled(!c.isEnabled()); - } - } + public void setAufgeben(JButton aufgeben) { + this.aufgeben = aufgeben; } - /** - * Adds the buttons to the boardpanel - */ - public void applyBoardButtons() { - for (JButton b : buttons) { - panelLinks.add(b); - } + public JButton getAufgeben2() { + return aufgeben2; } - public JButton getAufgeben() { - return aufgeben; - } - - public void setAufgeben(JButton aufgeben) { - this.aufgeben = aufgeben; - } - - public JButton getAufgeben2() { - return aufgeben2; - } - - public void setAufgeben2(JButton aufgeben2) { - this.aufgeben2 = aufgeben2; - } + public void setAufgeben2(JButton aufgeben2) { + this.aufgeben2 = aufgeben2; + } }