From 4139b082ae837f5ed0f255bedeeee19828f7df19 Mon Sep 17 00:00:00 2001 From: dlopatin Date: Sun, 18 Feb 2024 15:45:11 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=BE=D1=80=D0=BC=D0=B0=20+=20=D1=81?= =?UTF-8?q?=D0=BB=D0=BE=D0=B2=D0=B0=D1=80=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WarmlyLocomotive/src/DirectionType.java | 3 +++ .../src/EntityWarmlyLocomotive.java | 8 +++--- .../src/FormWarmlyLocomotive.java | 26 +++++++++++++++++++ WarmlyLocomotive/src/Program.java | 4 ++- 4 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 WarmlyLocomotive/src/DirectionType.java create mode 100644 WarmlyLocomotive/src/FormWarmlyLocomotive.java diff --git a/WarmlyLocomotive/src/DirectionType.java b/WarmlyLocomotive/src/DirectionType.java new file mode 100644 index 0000000..dcdeeef --- /dev/null +++ b/WarmlyLocomotive/src/DirectionType.java @@ -0,0 +1,3 @@ +public enum DirectionType { + Up, Down, Right, Left; +} diff --git a/WarmlyLocomotive/src/EntityWarmlyLocomotive.java b/WarmlyLocomotive/src/EntityWarmlyLocomotive.java index 5c23240..2034496 100644 --- a/WarmlyLocomotive/src/EntityWarmlyLocomotive.java +++ b/WarmlyLocomotive/src/EntityWarmlyLocomotive.java @@ -20,10 +20,12 @@ public class EntityWarmlyLocomotive { private boolean FuelTank; public boolean getFuelTank() { return FuelTank; } - public double Step = Speed * 100 / Weight; + public double Step() { + return Speed * 100 / Weight; + } - public void Init(int speed, double weight, Color bodyColor, Color -additionalColor, boolean tube, boolean fuelTank) + public void Init(int speed, double weight, Color bodyColor, Color + additionalColor, boolean tube, boolean fuelTank) { Speed = speed; Weight = weight; diff --git a/WarmlyLocomotive/src/FormWarmlyLocomotive.java b/WarmlyLocomotive/src/FormWarmlyLocomotive.java new file mode 100644 index 0000000..1179023 --- /dev/null +++ b/WarmlyLocomotive/src/FormWarmlyLocomotive.java @@ -0,0 +1,26 @@ +import javax.swing.*; + +public class FormWarmlyLocomotive extends JFrame { + public void Initialize(){ + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setSize(900, 500); + setVisible(true); + setTitle("Тепловоз"); + setResizable(false); + + //pictireBox + JPanel pictureBox = new JPanel(); + pictureBox.setSize(getWidth(), getHeight()); + pictureBox.setLayout(null); + + //createButton + JButton createButton = new JButton("Создать"); + createButton.setBounds(20, 420, 90, 25); + pictureBox.add(createButton); + + add(pictureBox); + + } + + +} diff --git a/WarmlyLocomotive/src/Program.java b/WarmlyLocomotive/src/Program.java index 14991a8..0bb673b 100644 --- a/WarmlyLocomotive/src/Program.java +++ b/WarmlyLocomotive/src/Program.java @@ -1,5 +1,7 @@ + public class Program { public static void main(String[] args) { - System.out.println("Hello, World!"); + FormWarmlyLocomotive form = new FormWarmlyLocomotive(); + form.Initialize(); } }