From 50c36f8838aafa7ea7571adfa6fc452ee4123973 Mon Sep 17 00:00:00 2001 From: Programmist73 Date: Thu, 24 Nov 2022 23:25:21 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=BF=D0=BE=20=D0=BE=D1=84?= =?UTF-8?q?=D0=BE=D1=80=D0=BC=D0=BB=D0=B5=D0=BD=D0=B8=D1=8E.=20=D0=97?= =?UTF-8?q?=D0=B0=D0=B2=D0=B5=D1=80=D1=88=D1=91=D0=BD=D0=BD=D0=B0=D1=8F=20?= =?UTF-8?q?6-=D1=8F=20=D0=BB=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=BD=D0=B0=D1=8F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Project/src/FormMapWithSetPlanesGeneric.java | 3 ++- Project/src/FormPlaneConfig.java | 25 ++++++++++---------- Project/src/MapWithSetPlanesGeneric.java | 1 - Project/src/MapsCollection.java | 3 +-- 4 files changed, 16 insertions(+), 16 deletions(-) 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) { } } }