From 179f3ecb140b950185e02ff53335e3de67d2936d Mon Sep 17 00:00:00 2001 From: Programmist73 Date: Thu, 24 Nov 2022 23:17:14 +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 | 4 +++- Project/src/FormPlaneConfig.java | 25 ++++++++++---------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Project/src/FormMapWithSetPlanesGeneric.java b/Project/src/FormMapWithSetPlanesGeneric.java index 9e59919..88b52b3 100644 --- a/Project/src/FormMapWithSetPlanesGeneric.java +++ b/Project/src/FormMapWithSetPlanesGeneric.java @@ -214,6 +214,7 @@ public class FormMapWithSetPlanesGeneric extends JFrame{ } } }); + form.setSize(975, 360); form.setVisible(true); } @@ -365,7 +366,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) {