From 15fad249f537fa859e06451c9c308b4ff969ca4c 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: Mon, 13 Nov 2023 00:36:16 +0400 Subject: [PATCH] =?UTF-8?q?=D0=93=D0=BE=D1=82=D0=BE=D0=B2=D0=B0=D1=8F=20?= =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82=D0=BE=D1=80=D0=BD?= =?UTF-8?q?=D0=B0=D1=8F=204?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tank/src/DrawingTank.java | 7 ++++--- Tank/src/FormTankCollection.java | 11 ++++------- Tank/src/SetGeneric.java | 2 +- Tank/src/TanksGenericCollections.java | 12 ++++++------ 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/Tank/src/DrawingTank.java b/Tank/src/DrawingTank.java index edcc883..1dffe39 100644 --- a/Tank/src/DrawingTank.java +++ b/Tank/src/DrawingTank.java @@ -4,10 +4,11 @@ public class DrawingTank extends DrawingArmoVehicle { protected IOrnamentForm OrnamentsForm; private boolean OrnamentAdd; + // Конструктор (Инициализация характеристик) public DrawingTank(int speed, double weight, Color bodyColor, int _numWheel, Color additionalColor, boolean bodyKit, boolean caterpillar, boolean tower, int width, int height, boolean ornamentAdd) { super(speed, weight, bodyColor, _numWheel, width, height); ArmoVehicle = new EntityTank(speed, weight, bodyColor, _numWheel, additionalColor, bodyKit, caterpillar, tower); - _TankWidth = ((EntityTank) ArmoVehicle).BodyKit ? 169 : 83; + _TankWidth = ((EntityTank)ArmoVehicle).BodyKit ? 169 : 83; this.OrnamentAdd = ornamentAdd; } @@ -20,8 +21,8 @@ public class DrawingTank extends DrawingArmoVehicle { } public void SetPosition(int x, int y) { - _startPosX = Math.min(x, _pictureWidth - _TankWidth); - _startPosY = Math.min(y, _pictureHeight - _TankHeight); + _startPosX = Math.min(x, _pictureWidth-_TankWidth); + _startPosY = Math.min(y, _pictureHeight-_TankHeight); } private boolean setOrnamentAdd() { diff --git a/Tank/src/FormTankCollection.java b/Tank/src/FormTankCollection.java index d902c7f..3c893fd 100644 --- a/Tank/src/FormTankCollection.java +++ b/Tank/src/FormTankCollection.java @@ -158,8 +158,8 @@ public class FormTankCollection { } ); - JButton toForm4GenericDopClass = new JButton("Генерация"); - toForm4GenericDopClass.addActionListener( + JButton toFormTankGenerate = new JButton("Генерация"); + toFormTankGenerate.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { FormTankGenerate formTankGenerate = new FormTankGenerate(); @@ -214,7 +214,7 @@ public class FormTankCollection { TextBoxNumber.setBounds(pictureBoxWidth - 10, 50, 170, 30); ButtonRemoveTank.setBounds(pictureBoxWidth - 10, 90, 170, 30); ButtonRefreshCollection.setBounds(pictureBoxWidth - 10, 130, 170, 30); - toForm4GenericDopClass.setBounds(pictureBoxWidth - 10, 170, 170, 30); + toFormTankGenerate.setBounds(pictureBoxWidth - 10, 170, 170, 30); buttonAddSet.setBounds(pictureBoxWidth - 10, 210, 170, 20); textBoxSetName.setBounds(pictureBoxWidth - 10, 240, 170, 20); @@ -228,15 +228,12 @@ public class FormTankCollection { Frame.add(ButtonRemoveTank); Frame.add(ButtonRefreshCollection); Frame.add(TextBoxNumber); - Frame.add(toForm4GenericDopClass); - + Frame.add(toFormTankGenerate); Frame.add(buttonAddSet); Frame.add(textBoxSetName); Frame.add(jListStorage); Frame.add(buttonRemoveSet); - Frame.add(buttonGetRemoved); - Frame.setVisible(true); } } \ No newline at end of file diff --git a/Tank/src/SetGeneric.java b/Tank/src/SetGeneric.java index 5877684..7ab88d6 100644 --- a/Tank/src/SetGeneric.java +++ b/Tank/src/SetGeneric.java @@ -8,7 +8,7 @@ public class SetGeneric { // Максимальное количество объектов в списке private final int _maxCount; - // Конструктор + // Конструктор public SetGeneric(int count) { _maxCount = count; _places = new ArrayList(count); diff --git a/Tank/src/TanksGenericCollections.java b/Tank/src/TanksGenericCollections.java index ef95d9a..427d83d 100644 --- a/Tank/src/TanksGenericCollections.java +++ b/Tank/src/TanksGenericCollections.java @@ -3,7 +3,7 @@ import java.awt.image.BufferedImage; public class TanksGenericCollections { - // Ширина и высота окна прорисовки + // Высота и ширина окна прорисовки private int _pictureWidth; private int _pictureHeight; @@ -15,11 +15,11 @@ public class TanksGenericCollections _collection; // Конструтор - public TanksGenericCollections(int picWidth, int picHeight) { - int width = picWidth / _placeSizeWidth; - int height = picHeight / _placeSizeHeight; - _pictureWidth = picWidth; - _pictureHeight = picHeight; + public TanksGenericCollections(int pictureWidth, int pictureHeight) { + int width = pictureWidth / _placeSizeWidth; + int height = pictureHeight / _placeSizeHeight; + _pictureWidth = pictureWidth; + _pictureHeight = pictureHeight; _collection = new SetGeneric(width * height); }