diff --git a/DrawningPlane.java b/DrawningPlane.java index 6600f0a..de288de 100644 --- a/DrawningPlane.java +++ b/DrawningPlane.java @@ -6,6 +6,7 @@ import java.util.random.RandomGenerator; public class DrawningPlane extends JPanel { private EntityPlane Plane; + public EntityPlane GetPlane(){ return Plane; } diff --git a/FormPlane.java b/FormPlane.java index b4f9c5f..fe8f8fe 100644 --- a/FormPlane.java +++ b/FormPlane.java @@ -15,9 +15,9 @@ public class FormPlane { private JButton ButtonRight; protected DrawningPlane PictureBoxPlane; private JToolBar StatusStrip; - private JLabel JLabelSpeed = new JLabel(); - private JLabel JLabelWeight = new JLabel(); - private JLabel JLabelColor = new JLabel(); + private final JLabel JLabelSpeed = new JLabel(); + private final JLabel JLabelWeight = new JLabel(); + private final JLabel JLabelColor = new JLabel(); public void Draw() { if (PictureBoxPlane.GetPlane() == null) { return; @@ -45,7 +45,7 @@ public class FormPlane { } ButtonCreate.addActionListener(e -> { Random random = new Random(); - PictureBoxPlane.Init(random.nextInt(100, 300), random.nextInt(1000, 2000), new Color(random.nextInt(256), random.nextInt(256), random.nextInt(256))); + PictureBoxPlane.Init(random.nextInt(100, 300),random.nextInt(1000, 2000),new Color(random.nextInt(256), random.nextInt(256), random.nextInt(256))); PictureBoxPlane.SetPosition(random.nextInt(10, 100), random.nextInt(10, 100), PictureBoxPlane.getWidth(), PictureBoxPlane.getHeight()); JLabelSpeed.setText("Cкорость: " + PictureBoxPlane.GetPlane().GetSpeed() + " "); JLabelWeight.setText("Вес: " + PictureBoxPlane.GetPlane().GetWeight() + " "); diff --git a/Main.java b/Main.java index dfdda90..0a4e1b1 100644 --- a/Main.java +++ b/Main.java @@ -3,7 +3,7 @@ import javax.swing.*; public class Main { public static void main(String[] args) { - JFrame frame = new JFrame("Корабль"); + JFrame frame = new JFrame("Самолёт"); frame.setContentPane(new FormPlane().Mainpanel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocation(500, 200);