LabWork01: Завершено
This commit is contained in:
parent
a48405450c
commit
92a11ea687
@ -79,6 +79,7 @@ public class DrawningTracktor {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Отрисовка Трактора
|
||||
public void DrawTransport(Graphics g)
|
||||
{
|
||||
|
@ -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()));
|
||||
|
Loading…
Reference in New Issue
Block a user