Мелкие правки по оформлению. Завершённая 6-я лабораторная.

This commit is contained in:
Programmist73 2022-11-24 23:17:14 +04:00
parent 55364bb619
commit 179f3ecb14
2 changed files with 16 additions and 13 deletions

View File

@ -214,6 +214,7 @@ public class FormMapWithSetPlanesGeneric extends JFrame{
} }
} }
}); });
form.setSize(975, 360); form.setSize(975, 360);
form.setVisible(true); form.setVisible(true);
} }
@ -365,7 +366,8 @@ public class FormMapWithSetPlanesGeneric extends JFrame{
public void keyTyped(KeyEvent e) { public void keyTyped(KeyEvent e) {
char c = e.getKeyChar(); char c = e.getKeyChar();
if ((c < '0') || (c > '9')) { if ((c < '0') || (c > '9'))
{
e.consume(); e.consume();
} }
} }

View File

@ -144,6 +144,13 @@ public class FormPlaneConfig extends JFrame{
LabelRectWindow.addMouseListener(drag); LabelRectWindow.addMouseListener(drag);
LabelTriangleWindow.addMouseListener(drag); LabelTriangleWindow.addMouseListener(drag);
//настройка DnD для перетаскивания формы иллюминаторов
AdditWindowDropObject(LabelSimpleWindow);
AdditWindowDropObject(LabelRectWindow);
AdditWindowDropObject(LabelTriangleWindow);
AdditWindowDropTarget(PictureBoxPlane);
//передача объекта через событие //передача объекта через событие
ButtonAddObject.addActionListener(e -> { ButtonAddObject.addActionListener(e -> {
EventAddPlane.accept(_plane); EventAddPlane.accept(_plane);
@ -152,12 +159,6 @@ public class FormPlaneConfig extends JFrame{
//лямбда-выражение для закрытия формы //лямбда-выражение для закрытия формы
ButtonCancel.addActionListener(e -> dispose()); ButtonCancel.addActionListener(e -> dispose());
AdditWindowDropObject(LabelSimpleWindow);
AdditWindowDropObject(LabelRectWindow);
AdditWindowDropObject(LabelTriangleWindow);
AdditWindowDropTarget(PictureBoxPlane);
} }
public void Drop(JComponent dropItem) public void Drop(JComponent dropItem)
@ -234,7 +235,7 @@ public class FormPlaneConfig extends JFrame{
obj.addMouseListener(new MouseAdapter() { obj.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseEntered(MouseEvent e) {super.mouseEntered(e); public void mouseEntered(MouseEvent e) {super.mouseEntered(e);
Paddle_DragEnter(obj); Window_DragEnter(obj);
} }
@Override @Override
public void mouseExited(MouseEvent e) {super.mouseExited(e); public void mouseExited(MouseEvent e) {super.mouseExited(e);
@ -248,16 +249,16 @@ public class FormPlaneConfig extends JFrame{
obj.addMouseListener(new MouseAdapter() { obj.addMouseListener(new MouseAdapter() {
@Override @Override
public void mousePressed(MouseEvent e) {super.mousePressed(e); public void mousePressed(MouseEvent e) {super.mousePressed(e);
Paddle_MouseDown(obj); Window_MouseDown(obj);
} }
@Override @Override
public void mouseReleased(MouseEvent e) {super.mouseReleased(e); public void mouseReleased(MouseEvent e) {super.mouseReleased(e);
Paddle_DragDrop(); Window_DragDrop();
} }
}); });
} }
void Paddle_MouseDown(Object sender) void Window_MouseDown(Object sender)
{ {
IAdditionalDrawingObject windows; IAdditionalDrawingObject windows;
switch (((JLabel)sender).getText()){ switch (((JLabel)sender).getText()){
@ -277,7 +278,7 @@ public class FormPlaneConfig extends JFrame{
enterObject = windows; enterObject = windows;
} }
void Paddle_DragEnter(Object sender) void Window_DragEnter(Object sender)
{ {
if(enterObject != null && IAdditionalDrawingObject.class.isAssignableFrom(enterObject.getClass()) && _plane != null) 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) if(dragObject == null)
{ {