fix lab 6

This commit is contained in:
Никита Белянин 2023-12-01 00:00:57 +04:00
parent 057e5a46e0
commit eba176d3cf
4 changed files with 17 additions and 17 deletions

View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_20" default="true" project-jdk-name="19" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_20" default="true" project-jdk-name="19" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />

View File

@ -14,7 +14,6 @@ import javax.swing.filechooser.FileNameExtensionFilter;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Queue; import java.util.Queue;
public class FormTankCollection { public class FormTankCollection {
private class Canvas extends JComponent { private class Canvas extends JComponent {
public Canvas() { public Canvas() {
@ -165,8 +164,8 @@ public class FormTankCollection {
} }
); );
JButton FormTankGenerate = new JButton("Генерация"); JButton toFormTankGenerate = new JButton("Генерировать технику");
FormTankGenerate.addActionListener( toFormTankGenerate.addActionListener(
new ActionListener() { new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
FormTankGenerate formTankGenerate = new FormTankGenerate(); FormTankGenerate formTankGenerate = new FormTankGenerate();
@ -331,26 +330,26 @@ public class FormTankCollection {
Frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Frame.setLayout(null); Frame.setLayout(null);
canv.setBounds(0, 0, pictureBoxWidth, pictureBoxHeight); canv.setBounds(0, 0, pictureBoxWidth, pictureBoxHeight);
ButtonAddVehicle.setBounds(pictureBoxWidth, 0, 160, 20); ButtonAddVehicle.setBounds(pictureBoxWidth - 10, 10, 170, 30);
TextBoxNumber.setBounds(pictureBoxWidth, 30, 160, 20); TextBoxNumber.setBounds(pictureBoxWidth - 10, 50, 170, 30);
ButtonRemoveTank.setBounds(pictureBoxWidth, 60, 160, 20); ButtonRemoveTank.setBounds(pictureBoxWidth - 10, 90, 170, 30);
ButtonRefreshCollection.setBounds(pictureBoxWidth, 90, 160, 20); ButtonRefreshCollection.setBounds(pictureBoxWidth - 10, 130, 170, 30);
FormTankGenerate.setBounds(pictureBoxWidth, 120, 160, 20); toFormTankGenerate.setBounds(pictureBoxWidth - 10, 170, 170, 30);
buttonAddSet.setBounds(pictureBoxWidth, 150, 160, 20); buttonAddSet.setBounds(pictureBoxWidth - 10, 210, 170, 20);
textBoxSetName.setBounds(pictureBoxWidth, 180, 160, 20); textBoxSetName.setBounds(pictureBoxWidth - 10, 240, 170, 20);
jListStorage.setBounds(pictureBoxWidth, 210, 160, 80); jListStorage.setBounds(pictureBoxWidth - 10, 270, 170, 80);
buttonRemoveSet.setBounds(pictureBoxWidth, 300, 160, 20); buttonRemoveSet.setBounds(pictureBoxWidth - 10, 360, 170, 20);
menuBar.setBounds(pictureBoxWidth, 360, 160, 20); buttonGetRemoved.setBounds(pictureBoxWidth - 10, 390, 170, 20);
buttonGetRemoved.setBounds(pictureBoxWidth, 330, 160, 20); menuBar.setBounds(pictureBoxWidth - 10, 420, 170, 20);
Frame.add(canv); Frame.add(canv);
Frame.add(ButtonAddVehicle); Frame.add(ButtonAddVehicle);
Frame.add(ButtonRemoveTank); Frame.add(ButtonRemoveTank);
Frame.add(ButtonRefreshCollection); Frame.add(ButtonRefreshCollection);
Frame.add(TextBoxNumber); Frame.add(TextBoxNumber);
Frame.add(FormTankGenerate); Frame.add(toFormTankGenerate);
Frame.add(buttonAddSet); Frame.add(buttonAddSet);
Frame.add(textBoxSetName); Frame.add(textBoxSetName);

View File

@ -31,7 +31,7 @@ public class TanksGenericStorage {
StringBuilder data = new StringBuilder(); StringBuilder data = new StringBuilder();
data.append(key).append("\n"); data.append(key).append("\n");
for (DrawingArmoVehicle elem: _tankStorages.get(key).getTanks(100)) { for (DrawingArmoVehicle elem: _tankStorages.get(key).getTanks(100)) {
if(_tankStorages.get(key).getTanks(100) == null) if(_tankStorages.get(key) == null)
break; break;
data.append(elem != null ? ExtentionDrawingTank.GetDataForSave(elem, _separatorForObjectWR) + "\n" : ""); data.append(elem != null ? ExtentionDrawingTank.GetDataForSave(elem, _separatorForObjectWR) + "\n" : "");
} }