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) {