Готовая лабораторная работа 3

This commit is contained in:
Никита Белянин 2023-11-12 16:04:13 +04:00
parent 0762d52e3b
commit 3f27d54ee7

View File

@ -26,7 +26,7 @@ public class FormTank {
private AbstractStrategy abstractStrategy; private AbstractStrategy abstractStrategy;
Canvas canv; Canvas canv;
static int pictureBoxWidth = 980; static int pictureBoxWidth = 980;
static int pictureBoxHeight = 570; static int pictureBoxHeight = 560;
public JButton buttonSelectTank; public JButton buttonSelectTank;
public JFrame Frame; public JFrame Frame;
@ -37,7 +37,7 @@ public class FormTank {
public FormTank() { public FormTank() {
SelectedVehicle = null; SelectedVehicle = null;
Frame = new JFrame("Tank"); Frame = new JFrame("Tank");
JButton buttonCreate = new JButton("Добавить бронетехнику"); JButton buttonCreateArmoVehicle = new JButton("Добавить бронетехнику");
JButton buttonCreateTank = new JButton("Добавить танк"); JButton buttonCreateTank = new JButton("Добавить танк");
JButton buttonStrategysStep = new JButton("Шаг"); JButton buttonStrategysStep = new JButton("Шаг");
buttonSelectTank = new JButton("Добавить"); buttonSelectTank = new JButton("Добавить");
@ -139,7 +139,7 @@ public class FormTank {
} }
} }
); );
buttonCreate.addActionListener( buttonCreateArmoVehicle.addActionListener(
new ActionListener() { new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
Random random = new Random(); Random random = new Random();
@ -195,7 +195,7 @@ public class FormTank {
Frame.setLayout(null); Frame.setLayout(null);
canv = new Canvas(); canv = new Canvas();
canv.setBounds(0, 0, pictureBoxWidth, pictureBoxHeight); canv.setBounds(0, 0, pictureBoxWidth, pictureBoxHeight);
buttonCreate.setBounds(2, 520, 180, 40); buttonCreateArmoVehicle.setBounds(2, 520, 180, 40);
buttonCreateTank.setBounds(185, 520, 150, 40); buttonCreateTank.setBounds(185, 520, 150, 40);
up.setBounds(900, 480, 40, 40); up.setBounds(900, 480, 40, 40);
down.setBounds(900, 520, 40, 40); down.setBounds(900, 520, 40, 40);
@ -206,7 +206,7 @@ public class FormTank {
buttonSelectTank.setBounds(pictureBoxWidth / 2, 530, 150, 30); buttonSelectTank.setBounds(pictureBoxWidth / 2, 530, 150, 30);
Frame.add(buttonSelectTank); Frame.add(buttonSelectTank);
Frame.add(canv); Frame.add(canv);
Frame.add(buttonCreate); Frame.add(buttonCreateArmoVehicle);
Frame.add(buttonCreateTank); Frame.add(buttonCreateTank);
Frame.add(up); Frame.add(up);
Frame.add(down); Frame.add(down);