From eba176d3cf18f142677688423a3302ce9e9306c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0=20=D0=91=D0=B5=D0=BB?= =?UTF-8?q?=D1=8F=D0=BD=D0=B8=D0=BD?= Date: Fri, 1 Dec 2023 00:00:57 +0400 Subject: [PATCH] fix lab 6 --- Tank/.idea/misc.xml | 1 + Tank/src/FormTankCollection.java | 29 ++++++++++++++--------------- Tank/src/SetGeneric.java | 2 +- Tank/src/TanksGenericStorage.java | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Tank/.idea/misc.xml b/Tank/.idea/misc.xml index 1e4328b..5d30da4 100644 --- a/Tank/.idea/misc.xml +++ b/Tank/.idea/misc.xml @@ -1,3 +1,4 @@ + diff --git a/Tank/src/FormTankCollection.java b/Tank/src/FormTankCollection.java index 7fb5fd6..915f767 100644 --- a/Tank/src/FormTankCollection.java +++ b/Tank/src/FormTankCollection.java @@ -14,7 +14,6 @@ import javax.swing.filechooser.FileNameExtensionFilter; import java.util.LinkedList; import java.util.Queue; - public class FormTankCollection { private class Canvas extends JComponent { public Canvas() { @@ -165,8 +164,8 @@ public class FormTankCollection { } ); - JButton FormTankGenerate = new JButton("Генерация"); - FormTankGenerate.addActionListener( + JButton toFormTankGenerate = new JButton("Генерировать технику"); + toFormTankGenerate.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { FormTankGenerate formTankGenerate = new FormTankGenerate(); @@ -331,26 +330,26 @@ public class FormTankCollection { Frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Frame.setLayout(null); canv.setBounds(0, 0, pictureBoxWidth, pictureBoxHeight); - ButtonAddVehicle.setBounds(pictureBoxWidth, 0, 160, 20); - TextBoxNumber.setBounds(pictureBoxWidth, 30, 160, 20); - ButtonRemoveTank.setBounds(pictureBoxWidth, 60, 160, 20); - ButtonRefreshCollection.setBounds(pictureBoxWidth, 90, 160, 20); - FormTankGenerate.setBounds(pictureBoxWidth, 120, 160, 20); + ButtonAddVehicle.setBounds(pictureBoxWidth - 10, 10, 170, 30); + TextBoxNumber.setBounds(pictureBoxWidth - 10, 50, 170, 30); + ButtonRemoveTank.setBounds(pictureBoxWidth - 10, 90, 170, 30); + ButtonRefreshCollection.setBounds(pictureBoxWidth - 10, 130, 170, 30); + toFormTankGenerate.setBounds(pictureBoxWidth - 10, 170, 170, 30); - buttonAddSet.setBounds(pictureBoxWidth, 150, 160, 20); - textBoxSetName.setBounds(pictureBoxWidth, 180, 160, 20); - jListStorage.setBounds(pictureBoxWidth, 210, 160, 80); - buttonRemoveSet.setBounds(pictureBoxWidth, 300, 160, 20); - menuBar.setBounds(pictureBoxWidth, 360, 160, 20); + buttonAddSet.setBounds(pictureBoxWidth - 10, 210, 170, 20); + textBoxSetName.setBounds(pictureBoxWidth - 10, 240, 170, 20); + jListStorage.setBounds(pictureBoxWidth - 10, 270, 170, 80); + buttonRemoveSet.setBounds(pictureBoxWidth - 10, 360, 170, 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(ButtonAddVehicle); Frame.add(ButtonRemoveTank); Frame.add(ButtonRefreshCollection); Frame.add(TextBoxNumber); - Frame.add(FormTankGenerate); + Frame.add(toFormTankGenerate); Frame.add(buttonAddSet); Frame.add(textBoxSetName); diff --git a/Tank/src/SetGeneric.java b/Tank/src/SetGeneric.java index ee9f04e..a404521 100644 --- a/Tank/src/SetGeneric.java +++ b/Tank/src/SetGeneric.java @@ -4,7 +4,7 @@ public class SetGeneric { // Массив объектов, которые храним private final ArrayList _places; // Количество объектов в массиве - public int Count() { return _places.size(); } + public int Count() { return _places.size(); } // Максимальное количество объектов в списке private final int _maxCount; diff --git a/Tank/src/TanksGenericStorage.java b/Tank/src/TanksGenericStorage.java index 755d5ac..1d8569f 100644 --- a/Tank/src/TanksGenericStorage.java +++ b/Tank/src/TanksGenericStorage.java @@ -31,7 +31,7 @@ public class TanksGenericStorage { StringBuilder data = new StringBuilder(); data.append(key).append("\n"); for (DrawingArmoVehicle elem: _tankStorages.get(key).getTanks(100)) { - if(_tankStorages.get(key).getTanks(100) == null) + if(_tankStorages.get(key) == null) break; data.append(elem != null ? ExtentionDrawingTank.GetDataForSave(elem, _separatorForObjectWR) + "\n" : ""); }