Почти готово

This commit is contained in:
artur-kalimullin 2024-06-15 20:40:11 +04:00
parent c51d279cf8
commit e714e00fdb
3 changed files with 31 additions and 30 deletions

View File

@ -31,18 +31,19 @@ public class DrawningConstructor extends JComponent {
_drawEngine = new DrawningLongEngine(); _drawEngine = new DrawningLongEngine();
break; break;
} }
int engineCount = rnd.nextInt(1,4); int[] countengine = {2, 4, 6};
int engineCount = countengine[rnd.nextInt(countengine.length)];
_drawEngine.setNumber(engineCount); _drawEngine.setNumber(engineCount);
int typeBoat = rnd.nextInt(0,2); int typeBoat = rnd.nextInt(0,2);
switch (typeBoat) { switch (typeBoat) {
case 0: case 0:
_entityAirCraft = new EntityAirCraft(rnd.nextInt(30,100), rnd.nextInt(100,500), _entityAirCraft = new EntityAirCraft(rnd.nextInt(70 - 30) + 30, rnd.nextInt(500 - 100) + 100,
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)));
break; break;
case 1: case 1:
_entityAirCraft = new EntityAirFighter(rnd.nextInt(30,100), rnd.nextInt(100,500), _entityAirCraft = new EntityAirFighter(rnd.nextInt(70 - 30) + 30, rnd.nextInt(500 - 100) + 100,
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)),
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)),
rnd.nextBoolean(), rnd.nextBoolean()); rnd.nextBoolean(), rnd.nextBoolean());

View File

@ -25,8 +25,8 @@ public class FormAirCraftCollection extends JFrame {
final private JPanel labelPanel = new JPanel(); final private JPanel labelPanel = new JPanel();
final private JButton buttonAddAirCraft = new JButton("Добавить самолёт"); final private JButton buttonAddAirCraft = new JButton("Добавить самолёт");
final private JButton buttonAddAirFighter = new JButton("Добавить истребитель"); final private JButton buttonAddAirFighter = new JButton("Добавить истребитель");
final private JPanel addBoatPanel = new JPanel(); final private JPanel addAirCraftPanel = new JPanel();
final private JPanel addCatamaranPanel = new JPanel(); final private JPanel addAirFighterPanel = new JPanel();
final private JButton buttonRemove = new JButton("Удалить самолёт"); final private JButton buttonRemove = new JButton("Удалить самолёт");
final private JPanel removePanel = new JPanel(); final private JPanel removePanel = new JPanel();
final private JButton goToCheckButton = new JButton("Отправить на тесты"); final private JButton goToCheckButton = new JButton("Отправить на тесты");
@ -51,13 +51,13 @@ public class FormAirCraftCollection extends JFrame {
comboBoxPanel.setSize(new Dimension(130, 30)); comboBoxPanel.setSize(new Dimension(130, 30));
comboBoxPanel.add(comboBoxSelectorCompany, BorderLayout.CENTER); comboBoxPanel.add(comboBoxSelectorCompany, BorderLayout.CENTER);
addBoatPanel.setLayout(new BorderLayout()); addAirCraftPanel.setLayout(new BorderLayout());
addBoatPanel.setSize(170, 40); addAirCraftPanel.setSize(170, 40);
addBoatPanel.add(buttonAddAirCraft, BorderLayout.CENTER); addAirCraftPanel.add(buttonAddAirCraft, BorderLayout.CENTER);
addCatamaranPanel.setLayout(new BorderLayout()); addAirFighterPanel.setLayout(new BorderLayout());
addCatamaranPanel.setSize(170, 40); addAirFighterPanel.setSize(170, 40);
addCatamaranPanel.add(buttonAddAirFighter, BorderLayout.CENTER); addAirFighterPanel.add(buttonAddAirFighter, BorderLayout.CENTER);
removePanel.setLayout(new BorderLayout()); removePanel.setLayout(new BorderLayout());
removePanel.setSize(170, 40); removePanel.setSize(170, 40);
@ -92,8 +92,8 @@ public class FormAirCraftCollection extends JFrame {
jFrameCollectionAirCraft.add(toolsPanel); jFrameCollectionAirCraft.add(toolsPanel);
jFrameCollectionAirCraft.add(labelPanel); jFrameCollectionAirCraft.add(labelPanel);
jFrameCollectionAirCraft.add(comboBoxPanel); jFrameCollectionAirCraft.add(comboBoxPanel);
jFrameCollectionAirCraft.add(addBoatPanel); jFrameCollectionAirCraft.add(addAirCraftPanel);
jFrameCollectionAirCraft.add(addCatamaranPanel); jFrameCollectionAirCraft.add(addAirFighterPanel);
jFrameCollectionAirCraft.add(textBoxPanel); jFrameCollectionAirCraft.add(textBoxPanel);
jFrameCollectionAirCraft.add(removePanel); jFrameCollectionAirCraft.add(removePanel);
jFrameCollectionAirCraft.add(goToCheckPanel); jFrameCollectionAirCraft.add(goToCheckPanel);
@ -106,8 +106,8 @@ public class FormAirCraftCollection extends JFrame {
labelPanel.setLocation(jFrameCollectionAirCraft.getWidth() - 210, 0); labelPanel.setLocation(jFrameCollectionAirCraft.getWidth() - 210, 0);
toolsPanel.setLocation(jFrameCollectionAirCraft.getWidth() - 233, 0); toolsPanel.setLocation(jFrameCollectionAirCraft.getWidth() - 233, 0);
comboBoxPanel.setLocation(jFrameCollectionAirCraft.getWidth() - 200, 30); comboBoxPanel.setLocation(jFrameCollectionAirCraft.getWidth() - 200, 30);
addBoatPanel.setLocation(jFrameCollectionAirCraft.getWidth() - 200, 70); addAirCraftPanel.setLocation(jFrameCollectionAirCraft.getWidth() - 200, 70);
addCatamaranPanel.setLocation(jFrameCollectionAirCraft.getWidth() - 200, 120); addAirFighterPanel.setLocation(jFrameCollectionAirCraft.getWidth() - 200, 120);
textBoxPanel.setLocation(jFrameCollectionAirCraft.getWidth() - 200, 220); textBoxPanel.setLocation(jFrameCollectionAirCraft.getWidth() - 200, 220);
removePanel.setLocation(jFrameCollectionAirCraft.getWidth() - 200, 260); removePanel.setLocation(jFrameCollectionAirCraft.getWidth() - 200, 260);
goToCheckPanel.setLocation(jFrameCollectionAirCraft.getWidth() - 200, 300); goToCheckPanel.setLocation(jFrameCollectionAirCraft.getWidth() - 200, 300);

View File

@ -26,10 +26,10 @@ public class FormConstructor extends JFrame {
JLabel secondEntityLabel = new JLabel(); JLabel secondEntityLabel = new JLabel();
JLabel thirdEntityLabel = new JLabel(); JLabel thirdEntityLabel = new JLabel();
JPanel paddlesInfoPanel = new JPanel(); JPanel engineInfoPanel = new JPanel();
JLabel firstPaddlesLabel = new JLabel(); JLabel firstEngineLabel = new JLabel();
JLabel secondPaddlesLabel = new JLabel(); JLabel secondEngineLabel = new JLabel();
JLabel thirdPaddlesLabel = new JLabel(); JLabel thirdEngineLabel = new JLabel();
public void OpenFrame() { public void OpenFrame() {
@ -51,23 +51,23 @@ public class FormConstructor extends JFrame {
entitiesInfoPanel.add(secondEntityLabel); entitiesInfoPanel.add(secondEntityLabel);
entitiesInfoPanel.add(thirdEntityLabel); entitiesInfoPanel.add(thirdEntityLabel);
firstPaddlesLabel.setText(constructor.getEngineString(0)); firstEngineLabel.setText(constructor.getEngineString(0));
secondPaddlesLabel.setText(constructor.getEngineString(1)); secondEngineLabel.setText(constructor.getEngineString(1));
thirdPaddlesLabel.setText(constructor.getEngineString(2)); thirdEngineLabel.setText(constructor.getEngineString(2));
paddlesInfoPanel.setLayout(new BoxLayout(paddlesInfoPanel, BoxLayout.Y_AXIS)); engineInfoPanel.setLayout(new BoxLayout(engineInfoPanel, BoxLayout.Y_AXIS));
paddlesInfoPanel.setBorder(BorderFactory.createTitledBorder("Engine")); engineInfoPanel.setBorder(BorderFactory.createTitledBorder("Engine"));
paddlesInfoPanel.setSize(500, 130); engineInfoPanel.setSize(500, 130);
paddlesInfoPanel.setLocation(150, 150); engineInfoPanel.setLocation(150, 150);
paddlesInfoPanel.add(firstPaddlesLabel); engineInfoPanel.add(firstEngineLabel);
paddlesInfoPanel.add(secondPaddlesLabel); engineInfoPanel.add(secondEngineLabel);
paddlesInfoPanel.add(thirdPaddlesLabel); engineInfoPanel.add(thirdEngineLabel);
addButton.setBounds(0, jFrameConstructor.getHeight() - 105, 150, 50); addButton.setBounds(0, jFrameConstructor.getHeight() - 105, 150, 50);
reCreateButton.setBounds(0, jFrameConstructor.getHeight() - 135, 150, 30); reCreateButton.setBounds(0, jFrameConstructor.getHeight() - 135, 150, 30);
jFrameConstructor.add(paddlesInfoPanel); jFrameConstructor.add(engineInfoPanel);
jFrameConstructor.add(entitiesInfoPanel); jFrameConstructor.add(entitiesInfoPanel);
jFrameConstructor.add(addButton); jFrameConstructor.add(addButton);
jFrameConstructor.add(reCreateButton); jFrameConstructor.add(reCreateButton);