From 25361933d7d5641d15569aa462a0e6eac2828ff2 Mon Sep 17 00:00:00 2001 From: Yvonne Schmidt Date: Mon, 2 Dec 2024 08:13:06 +0100 Subject: [PATCH] added documentation for ConfirmTrade --- .../client/gui/popups/ConfirmTrade.java | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ConfirmTrade.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ConfirmTrade.java index 669791e..db1f065 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ConfirmTrade.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/ConfirmTrade.java @@ -20,12 +20,23 @@ import pp.monopoly.notification.Sound; * ConfirmTrade is a popup which appears when a trade is proposed to this certain player. */ public class ConfirmTrade extends Dialog { + /** Reference to the Monopoly application instance. */ private final MonopolyApp app; + + /** Main container for the "Confirm Trade" popup UI. */ private final Container confirmTradeContainer; + + /** Background container providing a border for the popup. */ private final Container backgroundContainer; + + /** The trade handler managing the details of the trade proposal. */ private TradeHandler tradeHandler; - + /** + * Constructs the "Confirm Trade" popup. + * + * @param app the Monopoly application instance + */ public ConfirmTrade(MonopolyApp app) { super(app.getDialogManager()); this.app = app; @@ -33,13 +44,12 @@ public class ConfirmTrade extends Dialog { // Create the background container backgroundContainer = new Container(); - backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); // Darker background + backgroundContainer.setBackground(new QuadBackgroundComponent(new ColorRGBA(0.8657f, 0.8735f, 0.8892f, 1.0f))); attachChild(backgroundContainer); - // Hauptcontainer für das Bestätigungspopup confirmTradeContainer = new Container(); - float padding = 10; // Passt den backgroundContainer an die Größe des confirmTradeContainer an + float padding = 10; backgroundContainer.setPreferredSize(confirmTradeContainer.getPreferredSize().addLocal(padding, padding, 0)); // Titel @@ -122,15 +132,18 @@ public class ConfirmTrade extends Dialog { } /** - * Schließt das Menü und entfernt die GUI-Elemente. + * Closes the popup and removes its GUI elements. */ @Override public void close() { - app.getGuiNode().detachChild(confirmTradeContainer); // Entferne das Menü - app.getGuiNode().detachChild(backgroundContainer); //Entfernt Rand + app.getGuiNode().detachChild(confirmTradeContainer); + app.getGuiNode().detachChild(backgroundContainer); super.close(); } + /** + * Opens the settings menu when the escape key is pressed. + */ @Override public void escape() { new SettingsMenu(app).open();