финал

This commit is contained in:
antoc0der 2023-12-22 09:27:41 +03:00
parent 7dd4ec395c
commit f3bf50d05f

View File

@ -247,7 +247,7 @@ public class FormAirplaneCollection {
Draw(); Draw();
} else { } else {
JOptionPane.showMessageDialog(null, "Не удалось добавить объект", "Информация", JOptionPane.INFORMATION_MESSAGE); JOptionPane.showMessageDialog(null, "Не удалось добавить объект", "Информация", JOptionPane.INFORMATION_MESSAGE);
_logger.warn("Не удалось добавить объект " );
} }
form.frameConfig.dispose(); form.frameConfig.dispose();
Draw(); Draw();
@ -283,13 +283,18 @@ public class FormAirplaneCollection {
String tmp = airplaneNumb.getText(); String tmp = airplaneNumb.getText();
int numb=Integer.parseInt(tmp); int numb=Integer.parseInt(tmp);
try { try {
DrawningAirplane curAirplane = _airplanes.Get(numb); if (_airplanes.Get(numb)!=null){
_trashCollection.Push(curAirplane); DrawningAirplane curAirplane = _airplanes.Get(numb);
_airplanes.Remove(numb); _trashCollection.Push(curAirplane);
_airplanes.ShowAirplanes(); _airplanes.Remove(numb);
JOptionPane.showMessageDialog(null, "Объект удален", "Информация", JOptionPane.INFORMATION_MESSAGE); _airplanes.ShowAirplanes();
Draw(); JOptionPane.showMessageDialog(null, "Объект удален", "Информация", JOptionPane.INFORMATION_MESSAGE);
_logger.info("Удален объект по позиции " + numb); Draw();
_logger.info("Удален объект по позиции " + numb);
} else{
throw new AirplaneNotFoundException(numb);
}
} catch (AirplaneNotFoundException ex) { } catch (AirplaneNotFoundException ex) {
JOptionPane.showMessageDialog(null, ex.getMessage()); JOptionPane.showMessageDialog(null, ex.getMessage());
_logger.warn("Не удалось удалить объект" + ex.getMessage()); _logger.warn("Не удалось удалить объект" + ex.getMessage());