This commit is contained in:
Timourka 2023-10-07 21:04:33 +04:00
parent b6967382fa
commit 2b2b700c59
4 changed files with 49 additions and 3 deletions

View File

@ -0,0 +1,39 @@
package laba1Loco;
import java.awt.*;
import java.util.*;
import javax.swing.*;
import javax.swing.Timer;
import java.awt.event.*;
public class EntityTrain {
/// <summary>
/// Скорость
/// </summary>
public int Speed;
/// <summary>
/// Вес
/// </summary>
public double Weight;
/// <summary>
/// Основной цвет
/// </summary>
public Color BodyColor;
/// <summary>
/// Шаг перемещения поезда
/// </summary>
public double Step;
/// <summary>
/// Инициализация полей объекта-класса Локомотива
/// </summary>
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес автомобиля</param>
/// <param name="bodyColor">Основной цвет</param>
public EntityTrain(int speed, double weight, Color bodyColor)
{
Speed = speed;
Weight = weight;
BodyColor = bodyColor;
Step = (double)Speed * 100 / Weight;
}
}

View File

@ -6,7 +6,7 @@ import javax.swing.*;
import javax.swing.Timer;
import java.awt.event.*;
public class Form1{
public class FormTrain{
private DrawingLoco _drawingLoco;
Canvas canv;
@ -14,7 +14,7 @@ public class Form1{
canv.repaint();
}
public Form1(){
public FormTrain(){
JFrame w=new JFrame ("Loco");
JButton buttonCreate = new JButton("create");
JButton up = new JButton();

View File

@ -2,6 +2,6 @@ package laba1Loco;
public class Main{
public static void main(String[] args) {
Form1 form1 = new Form1();
FormTrain formTrain = new FormTrain();
}
}

7
laba1Loco/Status.java Normal file
View File

@ -0,0 +1,7 @@
package laba1Loco;
public enum Status {
NotInit,
InProgress,
Finish
}