Minhasapov R.H. LabWork01 #1

Closed
safgerd wants to merge 3 commits from LabWork01 into master
2 changed files with 4 additions and 2 deletions
Showing only changes of commit 92a11ea687 - Show all commits

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