Готовая лабораторная работа 5

This commit is contained in:
Никита Белянин 2023-11-30 20:28:42 +04:00
parent 9829e4a9a5
commit b79b037e9e
3 changed files with 27 additions and 14 deletions

11
Tank/Tank.iml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -4,6 +4,7 @@ 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);
@ -12,6 +13,7 @@ public class DrawingTank extends DrawingArmoVehicle {
this.OrnamentAdd = ornamentAdd;
}
// Ещё один конструктор
public DrawingTank(int speed, float weight, Color bodyColor, int _numWheel, Color additionalColor, boolean bodyKit, boolean caterpillar, boolean tower, int width, int height) {
super(speed, weight, bodyColor, _numWheel, width, height);
ArmoVehicle=new EntityTank(speed,weight,bodyColor,_numWheel, additionalColor,bodyKit,caterpillar, tower);

View File

@ -152,14 +152,14 @@ public class FormTankCollection {
JButton ButtonRefreshCollection = new JButton("Обновить коллекцию");
ButtonRefreshCollection.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
public void actionPerformed(ActionEvent e){
Draw();
}
}
);
JButton FormTankGenerate = new JButton("Генерация");
FormTankGenerate.addActionListener(
JButton toFormTankGenerate = new JButton("Генерировать технику");
toFormTankGenerate.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
FormTankGenerate formTankGenerate = new FormTankGenerate();
@ -210,25 +210,25 @@ 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);
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, 330, 160, 20);
buttonGetRemoved.setBounds(pictureBoxWidth - 10, 390, 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);