From 96542fa42b34b5f219d2c236173373c062a0177d Mon Sep 17 00:00:00 2001 From: Johannes Schmelz Date: Mon, 2 Dec 2024 06:53:18 +0100 Subject: [PATCH] fixed numberformat --- .../src/main/java/pp/monopoly/client/gui/TradeMenu.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/TradeMenu.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/TradeMenu.java index f69eeba..8daf89a 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/TradeMenu.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/TradeMenu.java @@ -88,8 +88,10 @@ public class TradeMenu extends Dialog { } private void setTrades() { - tradeHandler.setOfferedAmount(Integer.parseInt(leftCurrencyInput.getText())); - tradeHandler.setRequestedAmount(Integer.parseInt(rightCurrencyInput.getText())); + String leftCurreny = leftCurrencyInput.getText().equals("")? "0" : leftCurrencyInput.getText(); + String rightCurreny = rightCurrencyInput.getText().equals("")? "0" : rightCurrencyInput.getText(); + tradeHandler.setOfferedAmount(Integer.parseInt(leftCurreny)); + tradeHandler.setRequestedAmount(Integer.parseInt(rightCurreny)); tradeHandler.setOfferedJailCards(Integer.parseInt(leftSpecialCardSelector.getSelectedItem())); tradeHandler.setRequestedJailCards(Integer.parseInt(rightSpecialCardSelector.getSelectedItem()));