]> Git Server - tankstelle.git/commitdiff
Fehler korrigiert master
authorSergej Pavlenko <sergepav0@gmail.com>
Sat, 22 Nov 2025 23:54:16 +0000 (00:54 +0100)
committerSergej Pavlenko <sergepav0@gmail.com>
Sat, 22 Nov 2025 23:54:16 +0000 (00:54 +0100)
src/main/java/de/diejungsvondertanke/tankstelle/FuelStationUI.java

index c9336980428c5a15d485c192cefb253b54168c2b..4a396aadd9947e836f048f2743e3bdfc3f460f2b 100644 (file)
@@ -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;
             }