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

@ -12,9 +12,9 @@
<margin top="0" left="0" bottom="0" right="0"/> <margin top="0" left="0" bottom="0" right="0"/>
<constraints> <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"> <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"/> <minimum-size width="400" height="320"/>
<preferred-size width="400" height="300"/> <preferred-size width="400" height="320"/>
<maximum-size width="400" height="300"/> <maximum-size width="400" height="320"/>
</grid> </grid>
</constraints> </constraints>
<properties/> <properties/>

@ -35,7 +35,7 @@ public class FormLocomotiveCollections {
public FormLocomotiveCollections() { public FormLocomotiveCollections() {
formElectricLocomotive = new FormElectricLocomotive(); formElectricLocomotive = new FormElectricLocomotive();
formLocomotiveConfig = new FormLocomotiveConfig(); formLocomotiveConfig = new FormLocomotiveConfig();
_storage = new LocomotivesGenericStorage(400,300); _storage = new LocomotivesGenericStorage(pictureBoxCollections.getWidth(), pictureBoxCollections.getHeight());
_stackRemoveObjects = new Stack<>(); _stackRemoveObjects = new Stack<>();
listBoxStorage.addListSelectionListener(this::listBoxObjectsSelectedIndexChanged); listBoxStorage.addListSelectionListener(this::listBoxObjectsSelectedIndexChanged);
@ -84,25 +84,11 @@ public class FormLocomotiveCollections {
JOptionPane.showMessageDialog(getPictureBoxCollections(), "Не удалось добавить объект"); JOptionPane.showMessageDialog(getPictureBoxCollections(), "Не удалось добавить объект");
} }
} }
//loco = frameLocomotiveConfig._formLocomotiveConfig.
}); });
//12 FrameElectricLocomotive frameElectricLocomotive = new FrameElectricLocomotive(); frameLocomotiveConfig._formLocomotiveConfig.buttonClose.addActionListener(e3 -> {
// frameElectricLocomotive.setVisible(true); frameLocomotiveConfig.dispose();
// 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(), "Не удалось добавить объект");
// }
// }
// });
}); });
ButtonCreateRandomLoco.addActionListener(e -> { ButtonCreateRandomLoco.addActionListener(e -> {

@ -29,7 +29,7 @@ public class FormLocomotiveConfig{
public JLabel lableSimpleObject; public JLabel lableSimpleObject;
private JLabel labelModifiedObject; private JLabel labelModifiedObject;
public JButton buttonOk; public JButton buttonOk;
private JButton buttonClose; public JButton buttonClose;
private JLabel labelColor; private JLabel labelColor;
private JLabel labelDopColor; private JLabel labelDopColor;
public JComponent pictureBoxObject; public JComponent pictureBoxObject;
@ -191,8 +191,6 @@ public class FormLocomotiveConfig{
} }
} }
public FormLocomotiveConfig() public FormLocomotiveConfig()
{ {
Border br = BorderFactory.createLineBorder(Color.BLACK); Border br = BorderFactory.createLineBorder(Color.BLACK);
@ -262,7 +260,6 @@ public class FormLocomotiveConfig{
} }
return false; 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(){ private void createUIComponents(){

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