Выполненная усложненная лабораторная работа №3(точно)
This commit is contained in:
parent
13cead9f97
commit
2321881dd1
@ -28,7 +28,6 @@ public class CreaterGeneric<T extends EntityWarship, U extends IDrawingObjectBlo
|
||||
public DrawingWarship NewWarshipCreating()
|
||||
{
|
||||
Random rand=new Random();
|
||||
DrawingWarship finalWarship;
|
||||
T warship = (T)Warships[rand.nextInt(WarshipsCount)];
|
||||
U block = (U)Blocks[rand.nextInt(BlocksCount)];
|
||||
if(warship instanceof EntityAdvancedWarship){
|
||||
|
@ -26,7 +26,7 @@
|
||||
<grid id="e26e" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="etched" title="Тип корабля:"/>
|
||||
@ -91,43 +91,6 @@
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="fc97" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="etched" title="Улучшения:"/>
|
||||
<children>
|
||||
<component id="fca4f" class="javax.swing.JCheckBox" binding="MissileCheckBox">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<label value="Боевые ракеты"/>
|
||||
<text value="Боевые ракеты"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="a7f46" class="javax.swing.JCheckBox" binding="AntennaCheckBox">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<label value="Антенна"/>
|
||||
<text value="Антенна"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="632da" class="javax.swing.JCheckBox" binding="HelipadCheckBox">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<label value="Вертолетная площадка"/>
|
||||
<text value="Вертолетная площадка"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="d3b9d" binding="CargoPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
@ -230,6 +193,43 @@
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<grid id="fc97" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="etched" title="Улучшения:"/>
|
||||
<children>
|
||||
<component id="fca4f" class="javax.swing.JCheckBox" binding="MissileCheckBox">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<label value="Боевые ракеты"/>
|
||||
<text value="Боевые ракеты"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="a7f46" class="javax.swing.JCheckBox" binding="AntennaCheckBox">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<label value="Антенна"/>
|
||||
<text value="Антенна"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="632da" class="javax.swing.JCheckBox" binding="HelipadCheckBox">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<label value="Вертолетная площадка"/>
|
||||
<text value="Вертолетная площадка"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
<hspacer id="ca2ae">
|
||||
|
@ -1,5 +1,7 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Random;
|
||||
|
||||
public class FormCreater extends JDialog{
|
||||
@ -92,17 +94,15 @@ public class FormCreater extends JDialog{
|
||||
createrGeneric.AddBlock(fblock);
|
||||
});
|
||||
|
||||
ShowWarshipButton.addActionListener(e -> {
|
||||
Random rand=new Random();
|
||||
if (BasicRadioButton.isSelected()) {
|
||||
BasicRadioButton.addActionListener(e -> {
|
||||
Color color=JColorChooser.showDialog(this,"Выберите цвет корпуса корабля",Color.WHITE);
|
||||
if(Integer.parseInt(SpeedTextField.getText())==0 || Integer.parseInt(WeightTextField.getText())==0 || color==null){
|
||||
return;
|
||||
}
|
||||
createrGeneric.AddWarship(new EntityWarship(Integer.parseInt(SpeedTextField.getText()),Integer.parseInt(WeightTextField.getText()),color));
|
||||
_warship=createrGeneric.NewWarshipCreating();
|
||||
}
|
||||
if (AdvancedRadioButton.isSelected()){
|
||||
});
|
||||
|
||||
AdvancedRadioButton.addActionListener(e -> {
|
||||
Color color1=JColorChooser.showDialog(this,"Выберите цвет корпуса корабля",Color.WHITE);
|
||||
if(Integer.parseInt(SpeedTextField.getText())==0 || Integer.parseInt(WeightTextField.getText())==0 || color1==null){
|
||||
return;
|
||||
@ -113,8 +113,11 @@ public class FormCreater extends JDialog{
|
||||
}
|
||||
createrGeneric.AddWarship(new EntityAdvancedWarship(Integer.parseInt(SpeedTextField.getText()),Integer.parseInt(WeightTextField.getText()),
|
||||
color1,color2,HelipadCheckBox.isSelected(),AntennaCheckBox.isSelected(),MissileCheckBox.isSelected()));
|
||||
});
|
||||
|
||||
ShowWarshipButton.addActionListener(e -> {
|
||||
Random rand=new Random();
|
||||
_warship=createrGeneric.NewWarshipCreating();
|
||||
}
|
||||
_warship.SetPosition(rand.nextInt(100),rand.nextInt(100),getWidth(),getHeight());
|
||||
repaint();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user