diff --git a/Project/src/FormMapWithSetPlanesGeneric.java b/Project/src/FormMapWithSetPlanesGeneric.java index 34173c0..be8d980 100644 --- a/Project/src/FormMapWithSetPlanesGeneric.java +++ b/Project/src/FormMapWithSetPlanesGeneric.java @@ -371,7 +371,8 @@ public class FormMapWithSetPlanesGeneric extends JFrame{ public void keyTyped(KeyEvent e) { char c = e.getKeyChar(); - if ((c < '0') || (c > '9')) { + if ((c < '0') || (c > '9')) + { e.consume(); } } diff --git a/Project/src/FormPlaneConfig.java b/Project/src/FormPlaneConfig.java index 4ca8353..6a6cce7 100644 --- a/Project/src/FormPlaneConfig.java +++ b/Project/src/FormPlaneConfig.java @@ -144,6 +144,13 @@ public class FormPlaneConfig extends JFrame{ LabelRectWindow.addMouseListener(drag); LabelTriangleWindow.addMouseListener(drag); + //настройка DnD для перетаскивания формы иллюминаторов + AdditWindowDropObject(LabelSimpleWindow); + AdditWindowDropObject(LabelRectWindow); + AdditWindowDropObject(LabelTriangleWindow); + + AdditWindowDropTarget(PictureBoxPlane); + //передача объекта через событие ButtonAddObject.addActionListener(e -> { EventAddPlane.accept(_plane); @@ -152,12 +159,6 @@ public class FormPlaneConfig extends JFrame{ //лямбда-выражение для закрытия формы ButtonCancel.addActionListener(e -> dispose()); - - AdditWindowDropObject(LabelSimpleWindow); - AdditWindowDropObject(LabelRectWindow); - AdditWindowDropObject(LabelTriangleWindow); - - AdditWindowDropTarget(PictureBoxPlane); } public void Drop(JComponent dropItem) @@ -234,7 +235,7 @@ public class FormPlaneConfig extends JFrame{ obj.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) {super.mouseEntered(e); - Paddle_DragEnter(obj); + Window_DragEnter(obj); } @Override public void mouseExited(MouseEvent e) {super.mouseExited(e); @@ -248,16 +249,16 @@ public class FormPlaneConfig extends JFrame{ obj.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) {super.mousePressed(e); - Paddle_MouseDown(obj); + Window_MouseDown(obj); } @Override public void mouseReleased(MouseEvent e) {super.mouseReleased(e); - Paddle_DragDrop(); + Window_DragDrop(); } }); } - void Paddle_MouseDown(Object sender) + void Window_MouseDown(Object sender) { IAdditionalDrawingObject windows; switch (((JLabel)sender).getText()){ @@ -277,7 +278,7 @@ public class FormPlaneConfig extends JFrame{ enterObject = windows; } - void Paddle_DragEnter(Object sender) + void Window_DragEnter(Object sender) { if(enterObject != null && IAdditionalDrawingObject.class.isAssignableFrom(enterObject.getClass()) && _plane != null) { @@ -286,7 +287,7 @@ public class FormPlaneConfig extends JFrame{ } } - void Paddle_DragDrop() + void Window_DragDrop() { if(dragObject == null) { diff --git a/Project/src/MapWithSetPlanesGeneric.java b/Project/src/MapWithSetPlanesGeneric.java index 44c1f87..d69dd2b 100644 --- a/Project/src/MapWithSetPlanesGeneric.java +++ b/Project/src/MapWithSetPlanesGeneric.java @@ -112,7 +112,6 @@ public class MapWithSetPlanesGeneric (_pictureWidth, _pictureHeight, map)); _mapStorage.get(element[0]).LoadData(element[2].split(String.valueOf(separatorData))); - } catch (Exception ex) { } } }