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<String> model = new DefaultComboBoxModel<>(names);
- comboFuelStations.setModel(model);
- }
-
/**
* Create Panel for searching for a fuel station with a specific fuel type
*
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).");
}
/**
- * 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) {