From dbfe33b36185abbc9a89f8c2720b5859c3fde266 Mon Sep 17 00:00:00 2001 From: Danila_Mochalov Date: Tue, 8 Nov 2022 16:50:09 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B4=D0=B0=D0=BD=D0=BD=D0=B0=D1=8F=20?= =?UTF-8?q?=D0=BB=D0=B0=D0=B1=D0=B0=204=20=D1=85=D0=B0=D1=80=D0=B4,=20?= =?UTF-8?q?=D1=82=D1=80=D0=B5=D0=B1=D1=83=D0=B5=D1=82=D1=81=D1=8F=20=D1=87?= =?UTF-8?q?=D0=B8=D1=81=D1=82=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FormMapWithSetLocomotives.java | 3 +++ MapWithSetLocomotivesGeneric.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/FormMapWithSetLocomotives.java b/FormMapWithSetLocomotives.java index fe5e7ae..4806d24 100644 --- a/FormMapWithSetLocomotives.java +++ b/FormMapWithSetLocomotives.java @@ -293,6 +293,9 @@ public class FormMapWithSetLocomotives extends JComponent { //первой лабораторной), передавая туда элемент из коллекции //удаленных, если там есть DrawningObjectLocomotive locomotive = _mapsCollection.Get(listBoxMaps.getSelectedValue().toString()).getDeleted(); + if (locomotive == null) { + JOptionPane.showMessageDialog(null, "No deleted objects"); + } if (locomotive != null) { JDialog dialog = new JDialog(formFrame, "Deleted", true); FormLocomotive formLocomotive = new FormLocomotive(dialog); diff --git a/MapWithSetLocomotivesGeneric.java b/MapWithSetLocomotivesGeneric.java index c9c8eec..4a8f5e6 100644 --- a/MapWithSetLocomotivesGeneric.java +++ b/MapWithSetLocomotivesGeneric.java @@ -48,7 +48,7 @@ public class MapWithSetLocomotivesGeneric { T temp = this._setLocomotives.Remove(position); if (temp == null) return null; - if (temp instanceof DrawningObjectLocomotive) deletedLocomotives.add((DrawningObjectLocomotive) temp); + deletedLocomotives.add((DrawningObjectLocomotive) temp); return temp; } /// Вывод всего набора объектов