Почти готово

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();
break;
}
int engineCount = rnd.nextInt(1,4);
int[] countengine = {2, 4, 6};
int engineCount = countengine[rnd.nextInt(countengine.length)];
_drawEngine.setNumber(engineCount);
int typeBoat = rnd.nextInt(0,2);
switch (typeBoat) {
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)));
break;
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)),
rnd.nextBoolean(), rnd.nextBoolean());

View File

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

View File

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