From 9538edcc1af12c50ebe06a1433160147808bc9d4 Mon Sep 17 00:00:00 2001 From: Senju Date: Tue, 4 Oct 2022 16:45:26 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D1=8B=20=D0=BD=D0=BE=D0=B2=D1=8B=D0=B5=20=D0=BA=D0=BB=D0=B0?= =?UTF-8?q?=D1=81=D1=81=D1=8B=20=D0=B8=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Resource/arrowDown.jpg | Bin 0 -> 1179 bytes Resource/arrowLeft.jpg | Bin 0 -> 1194 bytes Resource/arrowRight.jpg | Bin 0 -> 1196 bytes Resource/arrowUp.jpg | Bin 0 -> 1191 bytes src/CountBlocks.java | 14 +++++ src/Direction.java | 9 +-- src/DrawingBlock.java | 50 +++++++++++++++ src/DrawingField.java | 59 ++++++++++++++++++ src/DrawingWarship.java | 76 ++++++++++++++++++++--- src/EntityWarship.java | 5 +- src/FormWarship.java | 133 +++++++++++++++++++++++++++++++++++++++- src/Main.java | 4 +- 12 files changed, 330 insertions(+), 20 deletions(-) create mode 100644 Resource/arrowDown.jpg create mode 100644 Resource/arrowLeft.jpg create mode 100644 Resource/arrowRight.jpg create mode 100644 Resource/arrowUp.jpg create mode 100644 src/CountBlocks.java create mode 100644 src/DrawingBlock.java create mode 100644 src/DrawingField.java diff --git a/Resource/arrowDown.jpg b/Resource/arrowDown.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4813a5b13f10de1f7f3963ed49824b411c263211 GIT binary patch literal 1179 zcmex=``2_j6xdp@o1cgOJMMZh|#U;coyG6VInuyV4pa*FVB^NNrR z{vTivwh= zDOELf4NWZ*Q!{f5ODks=S2uSLPp{yR(6I1`$f)F$)U@=B%&g*)(z5c3%Btp;*0%PJ z&aO$5r%atTea6gLixw|gx@`H1m8&*w-m-Pu_8mKS9XfpE=&|D`PM*4S`O4L6*Kgds z_3+W-Cr_U}fAR9w$4{TXeEs(Q$Io9Ne=#yJL%ap|8JfQYf&OA*VPR%r2lxYE z#}NLy#lXYN2#h>tK?ZwDTKlp1SfA{4t*%rfN^TSKi^N;T5dS#!x)~Po8aqGEh zNB13Gc;nX1sAF}nR(7T)v9HYJw>z|#{hRL({S|-ge{6j;*ZQcG3;**9x9ruCDLvji z7x!#Pe4J$YU_zDP36nS0bG9F}|Do}|uf}*?)Zvd@8a07Styi616?NM^f5m~l=Ddx` zQ}}krRvy16`fK8Y{Spxsw-0}-+BUmX^zGa$nl|PF=_wm`oZ4|-LGZ>W4uvo4kK|@Q zwA=acJjaVTl`CuNPA+@xZ*=4598axd!o_djv{xK_-+Y_p?|+8>3@lGR#=icey6@8S zv}v|_|1xr??$Ys7o}B;St>S-%#=t~5_uqLn%2!I(i@QF$m~-sbD~-4BXNLccIsIw1 z{I|%m6?Uua_ZV;dZT0VZ**?(^KQGi&Kf7~u`E8@jTT=>tZklmG{>Aye%3BM}{TT8Z zuD_7)+M~F%;RIhm>REpHMVLo`d{0Erd$9p=mlwDX7sB~P4chxEbhA#^n|K9`vnM~@P literal 0 HcmV?d00001 diff --git a/Resource/arrowLeft.jpg b/Resource/arrowLeft.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0f9441d286a26ec777290220c9005bc1bb7d728f GIT binary patch literal 1194 zcmex=``2_j6xdp@o1cgOJMMZh|#U;coyG6VInuyV4pa*FVB^NNrR z{vTivTDoi-j64Z8S2#W<;`iIYoATtZSx zRZU$(Q_IBE%-q7#%Gt%$&E3P(D>x)HEIcAIDmf)JEj=SMtGJ}Jth}PKs=1}Lt-YhO zYtrN?Q>RUzF>}_U#Y>hhTfSoDs!f}>Y~8kf$Ie}c4j(ys?D&b3r!HN-a`oEv8#iw~ zeDwIq(`V0LynOZX)8{W=zkUDl^B2fpj10^WZ^3%h$X_cGze8aDXdi$F2 z-)VoG_U)PGEBENU!!{i+XVy(#H{R}C5qnC`DJRdcWvN(CNWcCd*=+T zcawRqe6ahp&OcT3y`1FVsqgkl{?XqVEA4*akN-#RfPhK&UU#j}PM%PIRa-gl_B*!6 zCm-al7Ck?2kNoelY_nNY%>FY7Y^k;vddcT>vNB!hcD#de(~EG98omYr7s7v)3M}*)76&@a5%8d*A=#>|S~HBl{sc^ABo^wNIulzI!`sn{{8! zddpPLz*>}w&r_!+*deMUps%O{)gIshPExfLA?G)%`g2}=Mm#6yJq6r yz4P4dt=Q5gZ)a_q*CO>h*z;1t#kWEnp`oEpy{kkR*q9nD82A`uH4W$gzX<@aI^Ht? literal 0 HcmV?d00001 diff --git a/Resource/arrowRight.jpg b/Resource/arrowRight.jpg new file mode 100644 index 0000000000000000000000000000000000000000..cea4be560b455dbfe13920c06e392505edc77148 GIT binary patch literal 1196 zcmex=``2_j6xdp@o1cgOJMMZh|#U;coyG6VInuyV4pa*FVB^NNrR z{vTivTDoi-j64Z8S2#W<;`iIYoATtZSx zRZU$(Q_IBE%-q7#%Gt%$&E3P(D>x)HEIcAIDmf)JEj=SMtGJ}Jth}PKs=1}Lt-YhO zYtrN?Q>RUzF>}_U#Y>hhTfSoDs!f}>Y~8kf$Ie}c4j(ys?D&b3r!HN-a`oEv8#iw~ zeDwIq(`V0LynOZX)8{W=zkUDl^B2fpj10^WZ^3yO7DZy(;z{71QP-RtY~)3^1uXiRMQ9OL8W5~yfzoIH6B zgQe*Q`_BIi4;Ife{m8cD?ZS*(byJh)Pt2d^J+ptO;zaig`j6vs|1+@i{OGKI)PGCs z^m}n{|sBsJg61Swtr}U;J!rkYbm?c>uU6_+qgd5IW=Y4 zU8PxKlf)U?-GY`Euo#>?_#$(G-NYY(KqI-XDPBq3{;_O6$F}0;(&RmhivI*|Oztnu zyI*qsUY#IN;;}E^{gBJ)k#C;`9Guw9=jN`wLZOMjAp5iXw~oKlqaVIqW2gIJ>e9zQ zydH`^-@G&Yx7(~E>3kA-H*c#?wUImW>-rn{k9N=fFKk___Hkd@4Tr$1hViTXZGBfAC!qvoS_fq8V zT8B0ZzA~Ke=qYm6|Caf;6>>(G9)E~$G3D-F%c$h>e(TJGo?nF+9!tb1zN%pDmtbDM zyzY=a*Sq{0`_-?$cU*|RpZn>?dewl3{*S!>IbYl9-&Vh2SJdmU{U4^h7R=(`A-Z8> xSj7GLk0x&L_{Lbb_51ynKZdCfb;a)cZERI+Q)SL#U}u(}Aj9}Vb8_``2_j6xdp@o1cgOJMMZh|#U;coyG6VInuyV4pa*FVB^NNrR z{vTivwh= zDOELf4NWZ*Q!{f5ODks=S2uSLPp{yR(6I1`$f)F$)U@=B%&g*)(z5c3%Btp;*0%PJ z&aO$5r%atTea6gLixw|gx@`H1m8&*w-m-Pu_8mKS9XfpE=&|D`PM*4S`O4L6*Kgds z_3+W-Cr_U}fAR9w$4{TXeEs(Q$Io9Ne=#yJL%ap|8JfQYf&OA*VPR%r2lxYE z#}NLy#lXYN2#h>tK?Zw<-@hL}Kc1`qV1Db9eY^6F-v0AQjEkJn+{%2tsg{9detm+i5XUO$@G>sY0p+2~!Uc0*^)!{07F{;mwolmESt_uBuvzT(jPfFFnRmw9V*dwUxi zxlitW_lCRvzDDy0)7y0?zWrnQpnJSouJYL0kIY9;Tf0g<+`l<@VydO`5AUC`Rdeqo zFwb(b)Nk9rZF#Sa@EUiyotjtPgnm2I%H%QQ!Jj>v%9j~FUI~AZe)vB_=Pmmq{QNgx zO$#@iu}(>7b>7d2YT-Y-`sO;WKlh*E)+&9*AE)leek^ZS{deZ0TmM?SiECfxwi-|P zq;#jj)~CLr^t?sl`OM#3ufydOKKOTRsZ=dyn_VrlQD*)WueDRKi$%ub+r#sxyfAqyA&_!~YDT z_ivr8O>1t7SfgSq9Fue6i}cTLGJ) z*JFFDKh=+K)FeLMFPJ^;qm96;SyRuxDLCPn5~-TbRd|Q(Xzl0UrZx6g_X+$_+7|so z>iUs?3Ujh1-`dZgnRrPto(y)l{HFY=>Rx_004 yN0Qf4wiQ&AGztb6JZQS9(9`vc|Ka=QgzLQ57OwDDy?W)o@rlQie6@T2-vj_z9_*a} literal 0 HcmV?d00001 diff --git a/src/CountBlocks.java b/src/CountBlocks.java new file mode 100644 index 0000000..bad36cb --- /dev/null +++ b/src/CountBlocks.java @@ -0,0 +1,14 @@ +package src; + +public enum CountBlocks { + TwoBlocks(2), + FourBlocks(4), + SixBlocks(6); + private final int Value; + CountBlocks(int count){ + Value=count; + } + public int GetBlockCount(){ + return Value; + } +} diff --git a/src/Direction.java b/src/Direction.java index 9c9bce1..200feac 100644 --- a/src/Direction.java +++ b/src/Direction.java @@ -1,8 +1,9 @@ package src; public enum Direction { - Up, - Down, - Left, - Right; + Up(1), + Down(2), + Left(3), + Right(4); + Direction(int value){} } diff --git a/src/DrawingBlock.java b/src/DrawingBlock.java new file mode 100644 index 0000000..8566e2a --- /dev/null +++ b/src/DrawingBlock.java @@ -0,0 +1,50 @@ +package src; +import java.awt.*; + +public class DrawingBlock { + private CountBlocks _block; + + public void SetBlockCount(int count){ + for (CountBlocks temp: CountBlocks.values()){ + if (temp.GetBlockCount() == count){ + _block=temp; + return; + } + } + } + + public void DrawBlock(Graphics2D g, int _startPosX, int _startPosY) { + Graphics2D g2 = (Graphics2D) g; + if (_block.GetBlockCount() <= 2) { + g2.setColor(Color.GRAY); + g2.fillRect(_startPosX + 15, _startPosY + 10, 10, 10); + g2.setColor(Color.BLACK); + g2.drawRect(_startPosX + 15, _startPosY + 10, 10, 10); + g2.setColor(Color.GRAY); + g2.fillRect(_startPosX + 15, _startPosY + 20, 10, 10); + g2.setColor(Color.BLACK); + g2.drawRect(_startPosX + 15, _startPosY + 20, 10, 10); + } + if (_block.GetBlockCount() <= 4) { + g2.setColor(Color.GRAY); + g2.fillRect(_startPosX+25,_startPosY+10,10,10); + g2.setColor(Color.BLACK); + g2.drawRect(_startPosX+25,_startPosY+10,10,10); + g2.setColor(Color.GRAY); + g2.fillRect(_startPosX+25,_startPosY+20,10,10); + g2.setColor(Color.BLACK); + g2.drawRect(_startPosX+25,_startPosY+20,10,10); + } + if (_block.GetBlockCount() <= 6) { + g2.setColor(Color.GRAY); + g2.fillRect(_startPosX+35,_startPosY+10,10,10); + g2.setColor(Color.BLACK); + g2.drawRect(_startPosX+35,_startPosY+10,10,10); + g2.setColor(Color.GRAY); + g2.fillRect(_startPosX+35,_startPosY+20,10,10); + g2.setColor(Color.BLACK); + g2.drawRect(_startPosX+35,_startPosY+20,10,10); + } + } +} + diff --git a/src/DrawingField.java b/src/DrawingField.java new file mode 100644 index 0000000..ff76954 --- /dev/null +++ b/src/DrawingField.java @@ -0,0 +1,59 @@ +package src; + +import javax.swing.*; +import java.awt.*; +import java.util.Random; + +public class DrawingField extends JPanel { + private final FormWarship Field; + DrawingWarship _warship; + public DrawingField(FormWarship field) { + this.Field = field; + } + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + Graphics2D g2 =(Graphics2D)g; + if (_warship!=null) + _warship.DrawTransport(g2); + else return; + } + public void UpButtonAction(){ + if (_warship!=null) + _warship.MoveTransport(Direction.Up); + else + return; + } + public void DownButtonAction(){ + if (_warship!=null) + _warship.MoveTransport(Direction.Down); + else + return; + } + public void RightButtonAction(){ + if (_warship!=null) + _warship.MoveTransport(Direction.Right); + else + return; + } + public void LeftButtonAction(){ + if (_warship!=null) + _warship.MoveTransport(Direction.Left); + else + return; + } + public void CreateButtonAction(){ + Random rand=new Random(); + _warship=new DrawingWarship(); + _warship.Init(rand.nextInt(50)+10,rand.nextInt(3000)+20000,new Color(rand.nextInt(256),rand.nextInt(256),rand.nextInt(256))); + _warship.SetPosition(rand.nextInt(100)+10,rand.nextInt(100)+10,getWidth(),getHeight()); + Field.SpeedLabel.setText("Скорость: "+_warship.GetWarship().GetSpeed()); + Field.WeightLabel.setText("Вес: "+_warship.GetWarship().GetWeight()); + Field.BodyColorLabel.setText("Цвет: "+Integer.toHexString(_warship.GetWarship().GetBodyColor().getRGB()).substring(2)); + } + public void ResizeField(){ + if (_warship!=null) + _warship.ChangeBorders(getWidth(),getHeight()); + else return; + } +} diff --git a/src/DrawingWarship.java b/src/DrawingWarship.java index 1cd3f5d..9d57ef9 100644 --- a/src/DrawingWarship.java +++ b/src/DrawingWarship.java @@ -1,26 +1,42 @@ package src; - import java.awt.*; +import java.util.Random; public class DrawingWarship { private EntityWarship Warship; + public DrawingBlock Blocks; public EntityWarship GetWarship(){return Warship;} - private float _startPosX; - private float _startPosY; + private int _startPosX; + private int _startPosY; private Integer _pictureWidth = null; private Integer _pictureHeight = null; - private final int _warshipWidth = 94; + private final int _warshipWidth = 114; private final int _warshipHeight = 40; public void Init(int speed, float weight, Color bodyColor) { Warship = new EntityWarship(); Warship.Init(speed, weight, bodyColor); + Blocks= new DrawingBlock(); + Blocks.SetBlockCount(BlockRandom()); + } + public int BlockRandom(){ + Random rand = new Random(); + int resRand = rand.nextInt(3); + if(resRand == 0){ + return 2; + } + if(resRand == 1){ + return 4; + } + if(resRand == 2){ + return 6; + } + return 0; } - public void SetPosition(int x, int y, int width, int height) { if (width >= x + _warshipWidth && height >= y + _warshipHeight && x >= 0 && y >= 0) @@ -31,7 +47,6 @@ public class DrawingWarship { _pictureHeight = height; } } - public void MoveTransport(Direction direction) { if (_pictureWidth == null || _pictureHeight == null) @@ -70,17 +85,60 @@ public class DrawingWarship { break; } } - public void DrawTransport(Graphics g){ if (_startPosX < 0 || _startPosY < 0 || _pictureHeight == null || _pictureWidth == null) { return; } Graphics2D g2 = (Graphics2D) g; - float[] pointXWarship = {_startPosX + 4, _startPosX + 94, _startPosX + 114, _startPosX + 94, _startPosX + 4}; - float[] pointYWarship = {_startPosY, _startPosY, _startPosY + 20, _startPosY + 40, _startPosY + 40}; + //главная палуба + int[] pointXWarship = {_startPosX + 4, _startPosX + 94, _startPosX + 114, _startPosX + 94, _startPosX + 4}; + int[] pointYWarship = {_startPosY, _startPosY, _startPosY + 20, _startPosY + 40, _startPosY + 40}; + g2.setColor(Warship.GetBodyColor()); + g2.fillPolygon(pointXWarship, pointYWarship, 5); + g2.setColor(Color.BLACK); + g2.drawPolygon(pointXWarship, pointYWarship, 5); + //мачта + g2.setColor(Color.WHITE); + g2.fillOval(_startPosX + 80, _startPosY + 13, 15, 15); + //границы мачты + g2.setColor(Color.BLACK); + g2.drawOval( _startPosX + 80, _startPosY + 13, 15, 15); + //палуба + g2.setColor(Color.WHITE); + g2.fillRect(_startPosX + 70, _startPosY + 10, 8, 18); + g2.fillRect(_startPosX + 55, _startPosY + 15, 15, 8); + //границы палубы + g2.setColor(Color.BLACK); + g2.drawRect(_startPosX + 70, _startPosY + 10, 8, 18); + g2.drawRect(_startPosX + 55, _startPosY + 15, 15, 8); + //двигатели + g2.fillRect(_startPosX, _startPosY + 5, 4, 10); + g2.fillRect(_startPosX, _startPosY + 23, 4, 10); + + //блоки + Blocks.DrawBlock(g2, _startPosX, _startPosY); + } + public void ChangeBorders(int width, int height) + { + _pictureWidth = width; + _pictureHeight = height; + if (_pictureWidth <= _warshipWidth || _pictureHeight <= _warshipHeight) + { + _pictureWidth = null; + _pictureHeight = null; + return; + } + if (_startPosX + _warshipWidth > _pictureWidth) + { + _startPosX = _pictureWidth - _warshipWidth; + } + if (_startPosY + _warshipHeight > _pictureHeight) + { + _startPosY = _pictureHeight - _warshipHeight; + } } } diff --git a/src/EntityWarship.java b/src/EntityWarship.java index aa9f85c..bfe2a95 100644 --- a/src/EntityWarship.java +++ b/src/EntityWarship.java @@ -5,15 +5,12 @@ import java.util.Random; public class EntityWarship { private int Speed; - private void SetSpeed(int speed){this.Speed = speed;} public int GetSpeed(){return Speed;} private float Weight; - private void SetWeight(float weight){this.Weight = weight;} public float GetWeight(){return Weight;} private Color BodyColor ; - private void SetBodyColor (Color bodyColor){this.BodyColor = bodyColor;} public Color GetBodyColor (){return BodyColor;} public float Step; @@ -23,7 +20,7 @@ public class EntityWarship { Speed = speed <= 0 ? rnd.nextInt(100) + 50 : speed; Weight = weight <= 0 ? rnd.nextInt(30)+40 : weight; BodyColor= bodyColor; - Step = Speed * 100 / Weight; + Step = Speed * 2000 / Weight; } } diff --git a/src/FormWarship.java b/src/FormWarship.java index bd6b839..454b793 100644 --- a/src/FormWarship.java +++ b/src/FormWarship.java @@ -1,7 +1,138 @@ package src; import javax.swing.*; - +import java.awt.*; +import java.awt.event.*; public class FormWarship extends JFrame{ + private int Width; + private int Height; + JPanel BottomPanel = new JPanel(); + JPanel CreatePanel = new JPanel(); + JPanel BottomAndCreatePanel = new JPanel(); + JPanel DimentionPanel = new JPanel(); + JPanel UPanel = new JPanel(); + JPanel DPanel = new JPanel(); + JPanel LRPanel = new JPanel(); + + JLabel SpeedLabel = new JLabel("Скорость: "); + JLabel WeightLabel = new JLabel("Вес: "); + JLabel BodyColorLabel = new JLabel("Цвет: "); + + DrawingField field = new DrawingField(this); + + JButton ButtonCreate=new JButton("Создать"); + + Icon iconUp = new ImageIcon("Resource\\arrowUp.jpg"); + JButton ButtonUp = new JButton(iconUp); + + Icon iconDown = new ImageIcon("Resource\\arrowDown.jpg"); + JButton ButtonDown = new JButton(iconDown); + + Icon iconRight = new ImageIcon("Resource\\arrowRight.jpg"); + JButton ButtonRight = new JButton(iconRight); + + Icon iconLeft = new ImageIcon("Resource\\arrowLeft.jpg"); + JButton ButtonLeft = new JButton(iconLeft); + + + public FormWarship(){ + super("Военный корабль"); + setSize(700,400); + Width = getWidth(); + Height = getHeight(); + ShowWindow(); + RefreshWindow(); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setVisible(true); + } + + public void ShowWindow(){ + + Dimension dimen = new Dimension(30,30); + + ButtonUp.setPreferredSize(dimen); + ButtonUp.addActionListener(e->{ + field.UpButtonAction(); + repaint(); + }); + + ButtonDown.setPreferredSize(dimen); + ButtonDown.addActionListener(e->{ + field.DownButtonAction(); + repaint(); + }); + + ButtonRight.setPreferredSize(dimen); + ButtonRight.addActionListener(e->{ + field.RightButtonAction(); + repaint(); + }); + + ButtonLeft.setPreferredSize(dimen); + ButtonLeft.addActionListener(e->{ + field.LeftButtonAction(); + repaint(); + }); + + LRPanel.setLayout(new FlowLayout(FlowLayout.CENTER,50,0)); + LRPanel.setBackground(new Color(0,0,0,0)); + LRPanel.add(ButtonLeft); + LRPanel.add(ButtonRight); + + UPanel.setLayout(new FlowLayout()); + UPanel.setBackground(new Color(0,0,0,0)); + UPanel.add(ButtonUp); + + DPanel.setLayout(new FlowLayout()); + DPanel.setBackground(new Color(0,0,0,0)); + DPanel.add(ButtonDown); + + DimentionPanel.setLayout(new BoxLayout(DimentionPanel,BoxLayout.Y_AXIS)); + DimentionPanel.setBackground(new Color(0,0,0,0)); + DimentionPanel.add(UPanel); + DimentionPanel.add(LRPanel); + DimentionPanel.add(DPanel); + add(DimentionPanel); + + CreatePanel.setLayout(new FlowLayout()); + CreatePanel.setBackground(new Color(0,0,0,0)); + CreatePanel.add(ButtonCreate); + ButtonCreate.addActionListener(e->{ + field.CreateButtonAction(); + repaint(); + }); + + BottomPanel.setLayout(new FlowLayout()); + BottomPanel.setBackground(new Color(0,0,0,0)); + BottomPanel.add(SpeedLabel); + BottomPanel.add(WeightLabel); + BottomPanel.add(BodyColorLabel); + + BottomAndCreatePanel.setLayout(new BoxLayout(BottomAndCreatePanel,BoxLayout.Y_AXIS)); + BottomAndCreatePanel.setBackground(new Color(0,0,0,0)); + BottomAndCreatePanel.add(CreatePanel); + BottomAndCreatePanel.add(BottomPanel); + + add(BottomAndCreatePanel); + add(field); + + addComponentListener(new ComponentAdapter() { + @Override + public void componentResized(ComponentEvent e) { + super.componentResized(e); + Width=getWidth(); + Height=getHeight(); + + field.ResizeField(); + repaint(); + RefreshWindow(); + } + }); + } + public void RefreshWindow(){ + field.setBounds(0,0,Width,Height); + BottomAndCreatePanel.setBounds(-220,Height-110,Width,80); + DimentionPanel.setBounds(Width-170,Height-170,190,140); + } } diff --git a/src/Main.java b/src/Main.java index 78037d5..0601d81 100644 --- a/src/Main.java +++ b/src/Main.java @@ -1,6 +1,6 @@ +package src; public class Main { public static void main(String[] args) { - - + new FormWarship(); } }