ready lab 5 yeea

This commit is contained in:
ekallin 2023-12-04 17:29:37 +04:00
parent 11104b9690
commit 00465b2d74
4 changed files with 9 additions and 36 deletions

View File

@ -12,9 +12,9 @@
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="true">
<minimum-size width="400" height="300"/>
<preferred-size width="400" height="300"/>
<maximum-size width="400" height="300"/>
<minimum-size width="400" height="320"/>
<preferred-size width="400" height="320"/>
<maximum-size width="400" height="320"/>
</grid>
</constraints>
<properties/>

View File

@ -35,7 +35,7 @@ public class FormLocomotiveCollections {
public FormLocomotiveCollections() {
formElectricLocomotive = new FormElectricLocomotive();
formLocomotiveConfig = new FormLocomotiveConfig();
_storage = new LocomotivesGenericStorage(400,300);
_storage = new LocomotivesGenericStorage(pictureBoxCollections.getWidth(), pictureBoxCollections.getHeight());
_stackRemoveObjects = new Stack<>();
listBoxStorage.addListSelectionListener(this::listBoxObjectsSelectedIndexChanged);
@ -84,25 +84,11 @@ public class FormLocomotiveCollections {
JOptionPane.showMessageDialog(getPictureBoxCollections(), "Не удалось добавить объект");
}
}
//loco = frameLocomotiveConfig._formLocomotiveConfig.
});
//12 FrameElectricLocomotive frameElectricLocomotive = new FrameElectricLocomotive();
// frameElectricLocomotive.setVisible(true);
// frameElectricLocomotive._formElectricLocomotive.ButtonSelectLocomotive.addActionListener(e2 -> {
// loco = frameElectricLocomotive._formElectricLocomotive._drawingLocomotive;
// frameElectricLocomotive.dispose();
// if (loco != null) {
// //проверяем, удалось ли нам загрузить объект
// if (obj.AddOverload(loco)!= -1) {
// JOptionPane.showMessageDialog(getPictureBoxCollections(), "Объект добавлен");
// Refresh();
// } else {
// JOptionPane.showMessageDialog(getPictureBoxCollections(), "Не удалось добавить объект");
// }
// }
// });
frameLocomotiveConfig._formLocomotiveConfig.buttonClose.addActionListener(e3 -> {
frameLocomotiveConfig.dispose();
});
});
ButtonCreateRandomLoco.addActionListener(e -> {

View File

@ -29,7 +29,7 @@ public class FormLocomotiveConfig{
public JLabel lableSimpleObject;
private JLabel labelModifiedObject;
public JButton buttonOk;
private JButton buttonClose;
public JButton buttonClose;
private JLabel labelColor;
private JLabel labelDopColor;
public JComponent pictureBoxObject;
@ -191,8 +191,6 @@ public class FormLocomotiveConfig{
}
}
public FormLocomotiveConfig()
{
Border br = BorderFactory.createLineBorder(Color.BLACK);
@ -262,7 +260,6 @@ public class FormLocomotiveConfig{
}
return false;
}
}
);
@ -358,17 +355,6 @@ public class FormLocomotiveConfig{
}
}
);
buttonClose.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
frameLocomotiveConfig.dispose();
}
}
);
}
public void Draw() {
pictureBoxObject.repaint();
}
private void createUIComponents(){

View File

@ -19,4 +19,5 @@ public class FrameLocomotiveConfig extends JFrame{
pack();
setVisible(true);
}
}