Borschevskaya A.A. Lab Work 1 Hard #1

Merged
eegov merged 9 commits from lab1 into master 2022-10-28 09:19:15 +04:00
3 changed files with 9 additions and 6 deletions
Showing only changes of commit 9bf470f992 - Show all commits

View File

@ -2,7 +2,7 @@ import java.awt.*;
import java.util.Random;
public class DrawingArmoredCar {
public EntityArmoredCar armoredCar;
private EntityArmoredCar armoredCar;
private float startPosX;
@ -18,6 +18,10 @@ public class DrawingArmoredCar {
private DrawingCaterpillar drawingCaterpillar;
public EntityArmoredCar getArmoredCar() {
return armoredCar;
}
public void Init(int speed, float weight, Color bodyColor) {
this.armoredCar = new EntityArmoredCar();
this.armoredCar.init(speed, weight, bodyColor);
@ -27,7 +31,7 @@ public class DrawingArmoredCar {
}
public void SetPosition(int x, int y, int width, int height) {
if (x > 0 && y > 0 && x + carWidth < width && y + carHeight < height) {
if (x >= 0 && y >= 0 && x + carWidth < width && y + carHeight < height) {
startPosX = x;
startPosY = y;
pictureWidth = width;

View File

@ -21,7 +21,6 @@ public class DrawingCaterpillar {
break;
}
}
}
public void DrawCaterpillar(Graphics2D g2d, int startPosX, int startPosY)

View File

@ -49,9 +49,9 @@ public class FormCar extends JFrame{
armoredCar.SetPosition(rnd.nextInt(90) + 10, rnd.nextInt(90) + 10,
drawPanel.getWidth(), drawPanel.getHeight());
labelSpeed.setText("Скорость: " + armoredCar.armoredCar.getSpeed());
labelWeight.setText("Вес: " + armoredCar.armoredCar.getWeight());
labelColor.setText("Цвет: " + armoredCar.armoredCar.getWeight());
labelSpeed.setText("Скорость: " + armoredCar.getArmoredCar().getSpeed());
labelWeight.setText("Вес: " + armoredCar.getArmoredCar().getWeight());
labelColor.setText("Цвет: " + armoredCar.getArmoredCar().getWeight());
}
});