From 023e390d3e1bae1bda0b5f6727629cad90722357 Mon Sep 17 00:00:00 2001 From: Sergej Pavlenko Date: Sun, 23 Nov 2025 00:54:16 +0100 Subject: [PATCH] Fehler korrigiert --- .../tankstelle/FuelStationUI.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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; } -- 2.43.0