diff --git a/src/main/java/FormArmoredCar.form b/src/main/java/FormArmoredCar.form
index e82df6d..5cbc8f9 100644
--- a/src/main/java/FormArmoredCar.form
+++ b/src/main/java/FormArmoredCar.form
@@ -22,7 +22,7 @@
-
+
@@ -40,7 +40,7 @@
-
+
@@ -49,7 +49,7 @@
-
+
@@ -60,7 +60,7 @@
-
+
@@ -69,7 +69,7 @@
-
+
@@ -77,6 +77,14 @@
+
+
+
+
+
+
+
+
diff --git a/src/main/java/FormArmoredCar.java b/src/main/java/FormArmoredCar.java
index 923ab88..cfea465 100644
--- a/src/main/java/FormArmoredCar.java
+++ b/src/main/java/FormArmoredCar.java
@@ -17,6 +17,7 @@ public class FormArmoredCar extends JFrame{
private JLabel labelSpeed;
private JLabel labelWeight;
private JLabel labelColor;
+ private JButton buttonCreate_Modif;
private DrawingArmoredCar armoredCar;
@@ -45,12 +46,7 @@ public class FormArmoredCar extends JFrame{
armoredCar = new DrawingArmoredCar(rnd.nextInt(100,300), rnd.nextInt(1000, 2000),
new Color(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)));
- armoredCar.SetPosition(rnd.nextInt(10, 100), rnd.nextInt(10, 100),
- drawPanel.getWidth(), drawPanel.getHeight());
-
- labelSpeed.setText("Скорость: " + armoredCar.getArmoredCar().getSpeed());
- labelWeight.setText("Вес: " + armoredCar.getArmoredCar().getWeight());
- labelColor.setText("Цвет: " + armoredCar.getArmoredCar().getBodyColor().getRGB());
+ setData();
}
});
@@ -93,6 +89,20 @@ public class FormArmoredCar extends JFrame{
setContentPane(mainPanel);
setVisible(true);
+ buttonCreate_Modif.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ Random rnd = new Random();
+ armoredCar = new DrawingTank(rnd.nextInt(100, 300), rnd.nextInt(1000,
+ 2000),
+ new Color(rnd.nextInt(0, 256), rnd.nextInt(0, 256), rnd.nextInt(0,
+ 256)),
+ new Color(rnd.nextInt(0, 256), rnd.nextInt(0, 256), rnd.nextInt(0,
+ 256)),
+ 1==rnd.nextInt(0, 2), 1==rnd.nextInt(0, 2));
+ setData();
+ }
+ });
}
private void createUIComponents() {
@@ -108,4 +118,13 @@ public class FormArmoredCar extends JFrame{
}
};
}
+
+ private void setData()
+ {
+ Random rnd = new Random();
+ armoredCar.SetPosition(rnd.nextInt(10, 100), rnd.nextInt(10, 100), drawPanel.getWidth(), drawPanel.getHeight());
+ labelSpeed.setText("Скорость: " + armoredCar.getArmoredCar().getSpeed());
+ labelWeight.setText("Вес: " + armoredCar.getArmoredCar().getWeight());
+ labelColor.setText("Цвет: " + armoredCar.getArmoredCar().getBodyColor().getRGB());
+ }
}
\ No newline at end of file