Корректировки

This commit is contained in:
AnnZhimol 2022-11-16 10:40:17 +04:00
parent b9677dd6e4
commit d16a35a31c
2 changed files with 7 additions and 7 deletions

View File

@ -10,7 +10,7 @@ public class CreaterGeneric<T extends EntityWarship, U extends IDrawingObjectBlo
Warships=new ArrayList<>(warshipsCount); Warships=new ArrayList<>(warshipsCount);
Blocks=new ArrayList<>(blocksCount); Blocks=new ArrayList<>(blocksCount);
} }
public int AddWarship(T warship){ public int Add(T warship){
if(WarshipsCount<=Warships.size()){ if(WarshipsCount<=Warships.size()){
Warships.add(warship); Warships.add(warship);
WarshipsCount++; WarshipsCount++;
@ -18,7 +18,7 @@ public class CreaterGeneric<T extends EntityWarship, U extends IDrawingObjectBlo
} }
return -1; return -1;
} }
public int AddBlock(U block){ public int Add(U block){
if(BlocksCount<=Blocks.size()){ if(BlocksCount<=Blocks.size()){
Blocks.add(block); Blocks.add(block);
BlocksCount++; BlocksCount++;

View File

@ -69,7 +69,7 @@ public class FormCreater extends JDialog{
if(fblock==null) if(fblock==null)
return; return;
fblock.SetBlockCount(block.GetBlockCount()); fblock.SetBlockCount(block.GetBlockCount());
createrGeneric.AddBlock(fblock); createrGeneric.Add(fblock);
}); });
RoundFormRadioButton.addActionListener(e -> { RoundFormRadioButton.addActionListener(e -> {
@ -80,7 +80,7 @@ public class FormCreater extends JDialog{
if(fblock==null) if(fblock==null)
return; return;
fblock.SetBlockCount(block.GetBlockCount()); fblock.SetBlockCount(block.GetBlockCount());
createrGeneric.AddBlock(fblock); createrGeneric.Add(fblock);
}); });
TriangleFormRadioButton.addActionListener(e -> { TriangleFormRadioButton.addActionListener(e -> {
@ -91,7 +91,7 @@ public class FormCreater extends JDialog{
if(fblock==null) if(fblock==null)
return; return;
fblock.SetBlockCount(block.GetBlockCount()); fblock.SetBlockCount(block.GetBlockCount());
createrGeneric.AddBlock(fblock); createrGeneric.Add(fblock);
}); });
BasicRadioButton.addActionListener(e -> { BasicRadioButton.addActionListener(e -> {
@ -99,7 +99,7 @@ public class FormCreater extends JDialog{
if(Integer.parseInt(SpeedTextField.getText())==0 || Integer.parseInt(WeightTextField.getText())==0 || color==null){ if(Integer.parseInt(SpeedTextField.getText())==0 || Integer.parseInt(WeightTextField.getText())==0 || color==null){
return; return;
} }
createrGeneric.AddWarship(new EntityWarship(Integer.parseInt(SpeedTextField.getText()),Integer.parseInt(WeightTextField.getText()),color)); createrGeneric.Add(new EntityWarship(Integer.parseInt(SpeedTextField.getText()),Integer.parseInt(WeightTextField.getText()),color));
}); });
AdvancedRadioButton.addActionListener(e -> { AdvancedRadioButton.addActionListener(e -> {
@ -111,7 +111,7 @@ public class FormCreater extends JDialog{
if(color2==null){ if(color2==null){
return; return;
} }
createrGeneric.AddWarship(new EntityAdvancedWarship(Integer.parseInt(SpeedTextField.getText()),Integer.parseInt(WeightTextField.getText()), createrGeneric.Add(new EntityAdvancedWarship(Integer.parseInt(SpeedTextField.getText()),Integer.parseInt(WeightTextField.getText()),
color1,color2,HelipadCheckBox.isSelected(),AntennaCheckBox.isSelected(),MissileCheckBox.isSelected())); color1,color2,HelipadCheckBox.isSelected(),AntennaCheckBox.isSelected(),MissileCheckBox.isSelected()));
}); });