From: Sergej Pavlenko Date: Sat, 22 Nov 2025 23:54:16 +0000 (+0100) Subject: Fehler korrigiert X-Git-Url: https://git.eternal.ddnss.de/?a=commitdiff_plain;ds=sidebyside;p=tankstelle.git Fehler korrigiert --- diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/FuelStationUI.java b/src/main/java/de/diejungsvondertanke/tankstelle/FuelStationUI.java index c933698..4a396aa 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/FuelStationUI.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/FuelStationUI.java @@ -643,11 +643,15 @@ public class FuelStationUI extends JFrame { if (pin.isEmpty()) { showError("Please enter a PIN."); + txtPin.setText(""); + txtEmployees.setText(""); return; } if (employees.isEmpty()) { showError("Please enter the available amount of employees."); + txtPin.setText(""); + txtEmployees.setText(""); return; } @@ -656,17 +660,23 @@ public class FuelStationUI extends JFrame { availableEmployees = Short.parseShort(employees); } catch (NumberFormatException ex) { showError("Please enter a valid amount of employees."); + txtPin.setText(""); + txtEmployees.setText(""); return; } int totalEmployees = Main.getTotalNumberOfEmployees(); if (availableEmployees >= totalEmployees) { showError("Please enter an amount of employees that is less than the total number of employees."); + txtPin.setText(""); + txtEmployees.setText(""); return; } if (availableEmployees <= 0) { showError("The amount of employees must be greater than 0."); + txtPin.setText(""); + txtEmployees.setText(""); return; } @@ -674,6 +684,9 @@ public class FuelStationUI extends JFrame { boolean ok = Main.isPINCorrect(pin); if (!ok) { showError("PIN is incorrect. Access denied."); + txtPin.setText(""); + txtEmployees.setText(""); + return; } } catch (IOException ex) { showError("Error trying to check the PIN: " + ex.getMessage()); @@ -683,6 +696,8 @@ public class FuelStationUI extends JFrame { FuelStation[] possibleFuelStations = Main.getFuelStationListWhenUnderstaffed(availableEmployees); if (possibleFuelStations.length == 0) { appendOutput("No fuel stations can function with the available amount of employees."); + txtPin.setText(""); + txtEmployees.setText(""); return; }