Mochalov D.V. Hard LabWork03 #3

Merged
eegov merged 13 commits from LabWork03 into LabWork02 2022-10-28 09:29:48 +04:00
Showing only changes of commit b28bb84cf8 - Show all commits

View File

@ -23,7 +23,10 @@ public class FormLocomotive extends JComponent{
JButton createButton = new JButton("Create");
createButton.addActionListener(e -> {
Random rnd = new Random();
_locomotive = new DrawningLocomotive(rnd.nextInt(200) + 100, rnd.nextInt(1000) + 1000, new Color(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)));
Color colorFirst = JColorChooser.showDialog(null, "Цвет", new Color(rnd.nextInt(256), rnd.nextInt(256),rnd.nextInt(256)));
_locomotive = new DrawningLocomotive(rnd.nextInt(200) + 100, rnd.nextInt(1000) + 1000, colorFirst);
_locomotive.SetPosition(10 + rnd.nextInt(90), 10 + rnd.nextInt(90), 800, 500-75);
speedLabel.setText("Speed: " + _locomotive.Locomotive.getSpeed());
weightLabel.setText("Weight: " + (int)_locomotive.Locomotive.getWeight());
@ -34,9 +37,13 @@ public class FormLocomotive extends JComponent{
JButton modifiedButton = new JButton("Modified");
modifiedButton.addActionListener(e -> {
Random rnd = new Random();
Color colorFirst = JColorChooser.showDialog(null, "Цвет", new Color(rnd.nextInt(256), rnd.nextInt(256),rnd.nextInt(256)));
Color colorSecond = JColorChooser.showDialog(null, "Цвет", new Color(rnd.nextInt(256), rnd.nextInt(256),rnd.nextInt(256)));
_locomotive = new DrawningWarmlyLocomotive(rnd.nextInt(200) + 100, rnd.nextInt(1000) + 1000,
new Color(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)),
new Color(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)),
colorFirst,
colorSecond,
rnd.nextBoolean(),
rnd.nextBoolean());
_locomotive.SetPosition(10 + rnd.nextInt(90), 10 + rnd.nextInt(90), 800, 500 - 75);