LabWork01: Завершено

This commit is contained in:
Safgerd 2022-11-05 23:32:00 +04:00
parent a48405450c
commit 92a11ea687
2 changed files with 4 additions and 2 deletions

View File

@ -79,6 +79,7 @@ public class DrawningTracktor {
break;
}
}
// Отрисовка Трактора
public void DrawTransport(Graphics g)
{

View File

@ -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()));