diff --git a/DrawningTracktor.java b/DrawningTracktor.java index e06d3b6..81d5ab1 100644 --- a/DrawningTracktor.java +++ b/DrawningTracktor.java @@ -79,6 +79,7 @@ public class DrawningTracktor { break; } } + // Отрисовка Трактора public void DrawTransport(Graphics g) { diff --git a/FormTracktor.java b/FormTracktor.java index 3d092b2..74b9158 100644 --- a/FormTracktor.java +++ b/FormTracktor.java @@ -2,8 +2,6 @@ import javax.swing.*; import java.awt.*; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; import java.util.Random; public class FormTracktor extends JFrame { @@ -29,17 +27,20 @@ public class FormTracktor extends JFrame { buttonCreate.addActionListener(e->{ Random rnd = new Random(); _tracktor = new DrawningTracktor(); + _tracktor.Init( rnd.nextInt(100, 300), rnd.nextInt(1000, 2000), new Color(rnd.nextInt(0, 256), rnd.nextInt(0, 256), rnd.nextInt(0, 256)), rnd.nextInt(3,8) ); + _tracktor.SetPosition( rnd.nextInt(10, 100), rnd.nextInt(10, 100), pictureBox.getWidth(), pictureBox.getHeight() ); + speedLabel.setText("Скорость: " + _tracktor.getTracktor().getSpeed()); weightLabel.setText("Вес: " + _tracktor.getTracktor().getWeight()); colorLabel.setText("Цвет: " + String.format("%h",_tracktor.getTracktor().getBodyColor()));