Готовая Лабораторная 4
This commit is contained in:
parent
0667fc1a0a
commit
15fad249f5
@ -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() {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@ import java.awt.image.BufferedImage;
|
||||
|
||||
|
||||
public class TanksGenericCollections<T extends DrawingArmoVehicle, U extends IMoveableObject> {
|
||||
// Ширина и высота окна прорисовки
|
||||
// Высота и ширина окна прорисовки
|
||||
private int _pictureWidth;
|
||||
private int _pictureHeight;
|
||||
|
||||
@ -15,11 +15,11 @@ public class TanksGenericCollections<T extends DrawingArmoVehicle, U extends IMo
|
||||
private SetGeneric<T> _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<T>(width * height);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user