From: Sergej Pavlenko Date: Thu, 20 Nov 2025 00:37:08 +0000 (+0100) Subject: Bug bei Liste gefixt X-Git-Url: https://git.eternal.ddnss.de/?a=commitdiff_plain;h=1509a79818a91e73df30334f3534f96a701f7a3a;p=tankstelle.git Bug bei Liste gefixt --- diff --git a/src/main/java/de/diejungsvondertanke/tankstelle/FuelStationUI.java b/src/main/java/de/diejungsvondertanke/tankstelle/FuelStationUI.java index a64f934..553c790 100644 --- a/src/main/java/de/diejungsvondertanke/tankstelle/FuelStationUI.java +++ b/src/main/java/de/diejungsvondertanke/tankstelle/FuelStationUI.java @@ -358,17 +358,6 @@ public class FuelStationUI extends JFrame { throw new NoSuchFuelTypeError("This fuel station does not offer the fuel type " + type); } - /** - * Updates the selection of fuel stations for the ComboBox - * - * @author Sergej Pavlenko - */ - private void updateStations() { - String[] names = buildStationNames(); - DefaultComboBoxModel model = new DefaultComboBoxModel<>(names); - comboFuelStations.setModel(model); - } - /** * Create Panel for searching for a fuel station with a specific fuel type * @@ -437,7 +426,7 @@ public class FuelStationUI extends JFrame { Main.addNewFuelStation(supermarketCompany); appendOutput("Fuel station with supermarket-company" + supermarketCompany + " has been added."); } - updateStations(); + refreshStationNames(); txtAtrributes.setText(""); } catch (NumberFormatException ex) { showError("Please enter a valid number (for small / medium)."); @@ -479,20 +468,16 @@ public class FuelStationUI extends JFrame { } /** - * Refreshes ComboBox and List together + * Updates the selection of fuel stations for ComboBox and List * * @author Sergej Pavlenko */ private void refreshStationNames() { String[] names = buildStationNames(); - if (comboFuelStations != null) { - comboFuelStations.setModel(new DefaultComboBoxModel<>(names)); - } + comboFuelStations.setModel(new DefaultComboBoxModel<>(names)); - if (listFuelStations != null) { - listFuelStations.setListData(names); - } + listFuelStations.setListData(names); } private String getDisplayName(FuelStation station) {