From b74e5b9fba9077eb5cc753ea8b96f62cca8bde1e Mon Sep 17 00:00:00 2001 From: prodigygirl Date: Sat, 22 Oct 2022 21:11:43 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BD=D1=81=D1=82=D1=80=D1=83?= =?UTF-8?q?=D0=BA=D1=82=D0=BE=D1=80=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/DrawingArmoredCar.java | 5 ++--- src/main/java/EntityArmoredCar.java | 2 +- src/main/java/FormArmoredCar.java | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/DrawingArmoredCar.java b/src/main/java/DrawingArmoredCar.java index b4fa674..a3bd38b 100644 --- a/src/main/java/DrawingArmoredCar.java +++ b/src/main/java/DrawingArmoredCar.java @@ -22,9 +22,8 @@ public class DrawingArmoredCar { return armoredCar; } - public void Init(int speed, float weight, Color bodyColor) { - this.armoredCar = new EntityArmoredCar(); - this.armoredCar.init(speed, weight, bodyColor); + public DrawingArmoredCar(int speed, float weight, Color bodyColor) { + this.armoredCar = new EntityArmoredCar(speed, weight, bodyColor); Random r = new Random(); this.drawingCaterpillar = new DrawingCaterpillar(); this.drawingCaterpillar.Init(r.nextInt(4, 7), bodyColor); diff --git a/src/main/java/EntityArmoredCar.java b/src/main/java/EntityArmoredCar.java index f1d54e5..4ad1d9f 100644 --- a/src/main/java/EntityArmoredCar.java +++ b/src/main/java/EntityArmoredCar.java @@ -7,7 +7,7 @@ public class EntityArmoredCar { private Color bodyColor; public float step; - public void init(int speed, float weight, Color bodyColor) { + public EntityArmoredCar(int speed, float weight, Color bodyColor) { this.speed = speed; this.weight = weight; this.bodyColor = bodyColor; diff --git a/src/main/java/FormArmoredCar.java b/src/main/java/FormArmoredCar.java index 045cdaa..923ab88 100644 --- a/src/main/java/FormArmoredCar.java +++ b/src/main/java/FormArmoredCar.java @@ -42,8 +42,7 @@ public class FormArmoredCar extends JFrame{ @Override public void actionPerformed(ActionEvent actionEvent) { Random rnd = new Random(); - armoredCar = new DrawingArmoredCar(); - armoredCar.Init(rnd.nextInt(100,300), rnd.nextInt(1000, 2000), + armoredCar = new DrawingArmoredCar(rnd.nextInt(100,300), rnd.nextInt(1000, 2000), new Color(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256))); armoredCar.SetPosition(rnd.nextInt(10, 100), rnd.nextInt(10, 100),