From 141801a3a7a27249b13274821a3996c17035ce54 Mon Sep 17 00:00:00 2001 From: victinass Date: Mon, 29 Apr 2024 12:08:52 +0400 Subject: [PATCH 1/2] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=20=E2=84=961?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/src/CanvasBattleship.java | 16 +++ src/src/DirectionType.java | 12 +++ src/src/DrawingBattleship.java | 177 +++++++++++++++++++++++++++++++++ src/src/DrawingBlocks.java | 96 ++++++++++++++++++ src/src/EntityBattleship.java | 28 ++++++ src/src/FormBattleship.java | 125 +++++++++++++++++++++++ src/src/Main.java | 6 +- src/src/NumberBlock.java | 5 + 8 files changed, 464 insertions(+), 1 deletion(-) create mode 100644 src/src/CanvasBattleship.java create mode 100644 src/src/DirectionType.java create mode 100644 src/src/DrawingBattleship.java create mode 100644 src/src/DrawingBlocks.java create mode 100644 src/src/EntityBattleship.java create mode 100644 src/src/FormBattleship.java create mode 100644 src/src/NumberBlock.java diff --git a/src/src/CanvasBattleship.java b/src/src/CanvasBattleship.java new file mode 100644 index 0000000..509257e --- /dev/null +++ b/src/src/CanvasBattleship.java @@ -0,0 +1,16 @@ +import javax.swing.*; +import java.awt.*; + +public class CanvasBattleship extends JComponent { + public DrawingBattleship _drawingBattleship; + public CanvasBattleship(){} + public void paintComponent(Graphics g) { + if (_drawingBattleship == null) { + return; + } + super.paintComponents(g); + Graphics2D g2d = (Graphics2D) g; + _drawingBattleship.DrawTransport(g2d); + super.repaint(); + } +} diff --git a/src/src/DirectionType.java b/src/src/DirectionType.java new file mode 100644 index 0000000..bcc73bd --- /dev/null +++ b/src/src/DirectionType.java @@ -0,0 +1,12 @@ + +public enum DirectionType +{ + Up, + + Down, + + Left, + + Right, + +} diff --git a/src/src/DrawingBattleship.java b/src/src/DrawingBattleship.java new file mode 100644 index 0000000..c4eb403 --- /dev/null +++ b/src/src/DrawingBattleship.java @@ -0,0 +1,177 @@ +import java.awt.*; + +public class DrawingBattleship +{ + public EntityBattleship EntityBattleship; + + private DrawingBlocks drawingBlocks = null; + + private Integer _pictureWidth; + + private Integer _pictureHeight; + + private Integer _startPosX; + + private Integer _startPosY; + + private int _drawingBattleshipWidth = 120; + + private int _drawingBattleshipHeight = 80; + + public void Init(int speed, double weight, Color bodyColor, Color additionalColor, boolean bodyDeck, boolean compartment, boolean tower, int numBlocks) + { + EntityBattleship = new EntityBattleship(); + EntityBattleship.Init(speed, weight, bodyColor, additionalColor, bodyDeck, compartment, tower); + _pictureWidth = null; + _pictureHeight = null; + _startPosX = null; + _startPosY = null; + drawingBlocks = new DrawingBlocks(); + drawingBlocks.setNumBlocks(numBlocks); + } + + public boolean SetPictureSize(int width, int height) + { + if (width < _drawingBattleshipWidth || height < _drawingBattleshipHeight) + { + return false; + } + _pictureWidth = width; + _pictureHeight = height; + if (_startPosX != null || _startPosY != null) + { + + if (_startPosX + _drawingBattleshipWidth > _pictureWidth) + { + _startPosX = _pictureWidth - _drawingBattleshipWidth; + } + else if (_startPosX < 0) _startPosX = 0; + if (_startPosY + _drawingBattleshipHeight > _pictureHeight) + { + _startPosY = _pictureHeight - _drawingBattleshipHeight; + } + else if (_startPosY < 0) _startPosY = 0; + } + return true; + } + + public void SetPosition(int x, int y) { + if (!(_pictureWidth != null && _pictureHeight != null)) return; + if (x + _drawingBattleshipWidth > _pictureWidth) + { + _startPosX = x - (x + _drawingBattleshipWidth - _pictureWidth); + } + else if (x < 0) _startPosX = 0; + else _startPosX = x; + if (y + _drawingBattleshipHeight > _pictureHeight) + { + _startPosY = y - (y + _drawingBattleshipHeight - _pictureHeight); + } + else if (y < 0) _startPosY = 0; + else _startPosY = y; + } + + public boolean MoveTransport(DirectionType direction) { + if (EntityBattleship == null || _startPosX == null || _startPosY == null) return false; + switch (direction) { + case Left: + if (_startPosX - EntityBattleship.Step > 0) { + _startPosX -= (int)EntityBattleship.Step; + } + return true; + case Up: + if (_startPosY - EntityBattleship.Step > 0) + { + _startPosY -= (int)EntityBattleship.Step; + } + return true; + case Right: + if (_startPosX + _drawingBattleshipWidth + (int)EntityBattleship.Step < _pictureWidth - EntityBattleship.Step) + { + _startPosX += (int)EntityBattleship.Step; + } + return true; + case Down: + if (_startPosY + _drawingBattleshipHeight + (int)EntityBattleship.Step < _pictureHeight - EntityBattleship.Step) + { + _startPosY += (int)EntityBattleship.Step; + } + return true; + default: + return false; + } + } + + public void DrawTransport(Graphics2D g) + { + if (EntityBattleship == null || _startPosX == null || _startPosY == null) + { + return; + } + int y = _startPosY; + + Color bodyColor = EntityBattleship.getBodyColor(); + Color additionalColor = EntityBattleship.getAdditionalColor(); + + //границы линкора + g.drawRect(_startPosX + 10, _startPosY, 80, 40); //ширина высота (сама палуба) + //заливка линкора + g.setColor(EntityBattleship.getBodyColor()); + g.fillRect(_startPosX + 10, _startPosY, 80, 40); + + //границы двигателей + g.drawRect(_startPosX + 5, _startPosY + 7, 5, 10); //двигатель верхний + g.drawRect(_startPosX + 5, _startPosY + 22, 5, 10); //двигатель нижний + //заливка двигателей (2 фигни сзади) + g.setColor(Color.BLACK); + g.fillRect(_startPosX + 5, _startPosY + 7, 5, 10); //верхний + g.fillRect(_startPosX + 5, _startPosY + 22, 5, 10); //нижний + + // блоки + drawingBlocks.drawBlocks(g, Color.BLACK, _startPosX, _startPosY); + + //носик палубы + int[] xPoints = {_startPosX + 90,_startPosX + 120, _startPosX + 90}; + int[] yPoints = {_startPosY,_startPosY + 20,_startPosY + 40}; + Polygon Points = new Polygon(xPoints, yPoints, 3); + g.drawPolygon(Points); + g.setColor(EntityBattleship.BodyColor); + g.fillPolygon(Points); + + + //круг на палубе + g.drawOval(_startPosX + 78, _startPosY + 12, 15, 15); + //заливка круга + g.setColor(Color.BLUE); + g.fillOval(_startPosX + 78, _startPosY + 12, 15, 15); + + //ПРОВЕРКА + + if (EntityBattleship.Compartment) + { + //отсеки для ракет + //заливка отсеков + g.setColor(EntityBattleship.getAdditionalColor()); + g.fillRect(_startPosX + 15, _startPosY + 5, 27, 5); //верхний отсек для ракет + g.fillRect(_startPosX + 15, _startPosY + 28, 27, 5); //нижний отсек для ракет + + //границы отсеков + g.drawRect(_startPosX + 15, _startPosY + 5, 27, 5); //верхний отсек + g.drawRect(_startPosX + 15, _startPosY + 28, 27, 5); //нижний отсек + + } + + if (EntityBattleship.Tower) + { + //границы башни + g.drawRect(_startPosX + 107, _startPosY + 17, 30, 5); + g.fillOval(_startPosX + 98, _startPosY + 15, 10, 10); + + //заливка башни + g.setColor(EntityBattleship.getAdditionalColor()); + g.fillOval(_startPosX + 98, _startPosY + 15, 10, 10); + g.fillRect(_startPosX + 107, _startPosY + 17, 30, 5); + + } + } +} diff --git a/src/src/DrawingBlocks.java b/src/src/DrawingBlocks.java new file mode 100644 index 0000000..27d1e5c --- /dev/null +++ b/src/src/DrawingBlocks.java @@ -0,0 +1,96 @@ +import java.awt.*; + +public class DrawingBlocks { + private NumberBlock numBlocks; + + //определяет количество блоков + public void setNumBlocks(int number) { + switch (number) { + case 1: + numBlocks = NumberBlock.Two; + break; + case 2: + numBlocks = NumberBlock.Four; + break; + case 3: + numBlocks = NumberBlock.Six; + break; + default: + numBlocks = NumberBlock.Four; + } + } + + public void drawBlocks(Graphics2D g2D, Color color, int _startPosX, int _startPosY) { + switch (numBlocks) { + case Two: + drawTwoBlocks(g2D, color, _startPosX, _startPosY); + break; + case Four: + drawFourBlocks(g2D, color, _startPosX, _startPosY); + break; + case Six: + drawSixBlocks(g2D, color, _startPosX, _startPosY); + break; + } + } + + private void drawTwoBlocks(Graphics2D g2D, Color color, int _startPosX, int _startPosY) { + //прямоугольник левый на палубе (горизонтальный) + g2D.setColor(Color.LIGHT_GRAY); + g2D.drawRect(_startPosX + 32, _startPosY + 13, 21, 12); + g2D.fillRect(_startPosX + 32, _startPosY + 13, 21, 12); + + //прямоугольник правый на палубе (вертикальный) + g2D.setColor(Color.GRAY); + g2D.drawRect(_startPosX + 53, _startPosY + 7, 16, 24); + g2D.fillRect(_startPosX + 53, _startPosY + 7, 16, 24); + } + + private void drawFourBlocks(Graphics2D g2D, Color color, int _startPosX, int _startPosY) { + + //прямоугольник левый на палубе (горизонтальный) + g2D.setColor(Color.magenta); + g2D.drawRect(_startPosX + 32, _startPosY + 13, 8, 12); + g2D.fillRect(_startPosX + 32, _startPosY + 13, 8, 12); + + //прямоугольник правый на палубе (вертикальный) + g2D.setColor(Color.GREEN); + g2D.drawRect(_startPosX + 53, _startPosY + 8, 16, 8); + g2D.fillRect(_startPosX + 53, _startPosY + 8, 16, 8); + + g2D.setColor(Color.GREEN); + g2D.drawRect(_startPosX + 53, _startPosY + 23, 16, 8); + g2D.fillRect(_startPosX + 53, _startPosY + 23, 16, 8); + + g2D.setColor(Color.DARK_GRAY); + g2D.drawRect(_startPosX + 19, _startPosY + 13, 8, 12); + g2D.fillRect(_startPosX + 19, _startPosY + 13, 8, 12); + + } + + private void drawSixBlocks(Graphics2D g2D, Color color, int _startPosX, int _startPosY) { + g2D.setColor(Color.GRAY); + g2D.drawRect(_startPosX + 19, _startPosY + 13, 10, 13); + g2D.fillRect(_startPosX + 19, _startPosY + 13, 10, 13); + + g2D.setColor(Color.LIGHT_GRAY); + g2D.drawRect(_startPosX + 31, _startPosY + 15, 12, 9); + g2D.fillRect(_startPosX + 31, _startPosY + 15, 12, 9); + + g2D.setColor(Color.PINK); + g2D.drawRect(_startPosX + 46, _startPosY + 13, 10, 13); + g2D.fillRect(_startPosX + 46, _startPosY + 13, 10, 13); + + g2D.setColor(Color.GRAY); + g2D.drawRect(_startPosX + 64, _startPosY + 4, 7, 8); + g2D.fillRect(_startPosX + 64, _startPosY + 4, 7, 8); + + g2D.setColor(Color.GRAY); + g2D.drawRect(_startPosX + 64, _startPosY + 15, 7, 8); + g2D.fillRect(_startPosX + 64, _startPosY + 15, 7, 8); + + g2D.setColor(Color.GRAY); + g2D.drawRect(_startPosX + 64, _startPosY + 28, 7, 8); + g2D.fillRect(_startPosX + 64, _startPosY + 28, 7, 8); + } +} diff --git a/src/src/EntityBattleship.java b/src/src/EntityBattleship.java new file mode 100644 index 0000000..4b5b2b0 --- /dev/null +++ b/src/src/EntityBattleship.java @@ -0,0 +1,28 @@ +import java.awt.*; +import java.util.Random; + +public class EntityBattleship +{ + public int Speed; + public double Weight; + public Color BodyColor; + public Color AdditionalColor; + public boolean BodyDeck; + public boolean Compartment; + public boolean Tower; + public double Step; + public Color getBodyColor() { return BodyColor; } + public Color getAdditionalColor() { return AdditionalColor; } + public double getStep() { return Speed * 100 / Weight; } + public void Init(int speed, double weight, Color bodyColor, Color additionalColor, boolean bodyDeck, boolean compartment, boolean tower) { + Random rnd = new Random(); + Speed = speed <= 0 ? rnd.nextInt(50, 150) : speed; + Weight = weight <= 0 ? rnd.nextInt(40,70) : weight; + BodyColor = bodyColor; + AdditionalColor = additionalColor; + BodyDeck = bodyDeck; + Compartment = compartment; + Tower = tower; + Step = Speed * 100 / Weight; + } +} diff --git a/src/src/FormBattleship.java b/src/src/FormBattleship.java new file mode 100644 index 0000000..43bf77a --- /dev/null +++ b/src/src/FormBattleship.java @@ -0,0 +1,125 @@ +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.util.Random; + +public class FormBattleship extends JFrame { + private String title; + private Dimension dimension; + private int Width, Height; + private CanvasBattleship canvasBattleship = new CanvasBattleship(); + private JButton CreateButton = new JButton("Создать");; + private JButton UpButton = new JButton(); + private JButton DownButton = new JButton();; + private JButton LeftButton = new JButton();; + private JButton RightButton = new JButton(); + public FormBattleship(String title, Dimension dimension) { + this.title = title; + this.dimension = dimension; + } + public void Init() { + setTitle(title); + setMinimumSize(dimension); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + Width = getWidth() - 15; + Height = getHeight() - 35; + + CreateButton.setName("CREATE"); + Icon iconUp = new ImageIcon("C:\\Users\\Админ\\Downloads\\arrowUp.png"); + UpButton.setIcon(iconUp); + UpButton.setName("Up"); + DownButton.setName("Down"); + Icon iconDown = new ImageIcon("C:\\Users\\Админ\\Downloads\\arrowDown.png"); + DownButton.setIcon(iconDown); + LeftButton.setName("Left"); + Icon iconLeft = new ImageIcon("C:\\Users\\Админ\\Downloads\\arrowLeft.png"); + LeftButton.setIcon(iconLeft); + RightButton.setName("Right"); + Icon iconRight = new ImageIcon("C:\\Users\\Админ\\Downloads\\arrowRight.png"); + RightButton.setIcon(iconRight); + + CreateButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + int StartPositionX = (int)(Math.random() * 90 + 10); + int StartPositionY = (int)(Math.random() * 90 + 10); + int speed = (int)(Math.random() * 300 + 100); + double weight = (double)(Math.random() * 3000 + 1000); + Color bodyColor = new Color((int)(Math.random() * 255 + 0),(int)(Math.random() * 255 + 0),(int)(Math.random() * 255 + 0)); + Color additionalColor = new Color((int)(Math.random() * 255 + 0),(int)(Math.random() * 255 + 0),(int)(Math.random() * 255 + 0));; + boolean bodyDeck = new Random().nextBoolean(); + boolean compartment = new Random().nextBoolean();; + boolean tower = new Random().nextBoolean(); + int blocksNum = (int)(Math.random() * 6) + 1; + canvasBattleship._drawingBattleship = new DrawingBattleship(); + canvasBattleship._drawingBattleship.Init(speed, weight, bodyColor, additionalColor, bodyDeck, compartment, tower, blocksNum); + canvasBattleship._drawingBattleship.SetPictureSize(Width, Height); + canvasBattleship._drawingBattleship.SetPosition(StartPositionX, StartPositionY); + canvasBattleship.repaint(); + } + }); + + ActionListener actionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent event) { + if (canvasBattleship._drawingBattleship == null) return; + boolean result = false; + switch ((((JButton)(event.getSource())).getName())) { + case "Up": + result = canvasBattleship._drawingBattleship.MoveTransport(DirectionType.Up); + break; + case "Down": + result = canvasBattleship._drawingBattleship.MoveTransport(DirectionType.Down); + break; + case "Left": + result = canvasBattleship._drawingBattleship.MoveTransport(DirectionType.Left); + break; + case "Right": + result = canvasBattleship._drawingBattleship.MoveTransport(DirectionType.Right); + break; + } + if (result) { + canvasBattleship.repaint(); + } + } + }; + UpButton.addActionListener(actionListener); + DownButton.addActionListener(actionListener); + LeftButton.addActionListener(actionListener); + RightButton.addActionListener(actionListener); + + setSize(dimension.width,dimension.height); + setLayout(null); + canvasBattleship.setBounds(0,0, getWidth(), getHeight()); + CreateButton.setBounds(10, getHeight() - 90, 100, 40); + UpButton.setBounds(getWidth() - 140, getHeight() - 160, 50, 50); + DownButton.setBounds(getWidth() - 140, getHeight() - 100, 50, 50); + RightButton.setBounds(getWidth() - 80, getHeight() - 100, 50, 50); + LeftButton.setBounds(getWidth() - 200, getHeight() - 100, 50, 50); + add(CreateButton); + add(UpButton); + add(DownButton); + add(RightButton); + add(LeftButton); + add(canvasBattleship); + setVisible(true); + //обработка события изменения размеров окна + addComponentListener(new ComponentAdapter() { + public void componentResized(ComponentEvent e) { + Width = getWidth() - 15; + Height = getHeight() - 35; + if (canvasBattleship._drawingBattleship != null) + canvasBattleship._drawingBattleship.SetPictureSize(Width, Height); + canvasBattleship.setBounds(0,0, getWidth(), getHeight()); + CreateButton.setBounds(10, getHeight() - 90, 100, 40); + UpButton.setBounds(getWidth() - 140, getHeight() - 160, 50, 50); + DownButton.setBounds(getWidth() - 140, getHeight() - 100, 50, 50); + RightButton.setBounds(getWidth() - 80, getHeight() - 100, 50, 50); + LeftButton.setBounds(getWidth() - 200, getHeight() - 100, 50, 50); + } + }); + } +} diff --git a/src/src/Main.java b/src/src/Main.java index 3e59c38..2d4032c 100644 --- a/src/src/Main.java +++ b/src/src/Main.java @@ -1,5 +1,9 @@ +import java.awt.*; + public class Main { public static void main(String[] args) { - System.out.println("Hello world!"); + FormBattleship form = new FormBattleship("Линкор", new Dimension(700,500)); + form.Init(); + } } \ No newline at end of file diff --git a/src/src/NumberBlock.java b/src/src/NumberBlock.java new file mode 100644 index 0000000..4efd0c6 --- /dev/null +++ b/src/src/NumberBlock.java @@ -0,0 +1,5 @@ +public enum NumberBlock { + Two, + Four, + Six +} \ No newline at end of file -- 2.25.1 From 5bfa75169fa370020f8a51bb877d45b7602195ce Mon Sep 17 00:00:00 2001 From: victinass Date: Mon, 29 Apr 2024 12:13:24 +0400 Subject: [PATCH 2/2] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=D0=B0=20=D1=81=D1=82=D1=80=D0=B5=D0=BB=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/res/arrowDown.png | Bin 0 -> 699 bytes src/res/arrowLeft.png | Bin 0 -> 713 bytes src/res/arrowRight.png | Bin 0 -> 711 bytes src/res/arrowUp.png | Bin 0 -> 687 bytes src/src/FormBattleship.java | 8 ++++---- 5 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 src/res/arrowDown.png create mode 100644 src/res/arrowLeft.png create mode 100644 src/res/arrowRight.png create mode 100644 src/res/arrowUp.png diff --git a/src/res/arrowDown.png b/src/res/arrowDown.png new file mode 100644 index 0000000000000000000000000000000000000000..f612502fa8b3966466e5a1c151b118daad3647f7 GIT binary patch literal 699 zcmeAS@N?(olHy`uVBq!ia0vp^Gk|y+2OE%7I^h@yq!^2X+?^QKos)S9a~60+7Besim4Gngy)^j>1_q`8PZ!6KinzCT4fEy%Ft}bU+%|=G$=R;U zY0Qz6je|D$81T$D+`hqLxg?iM>DM~uS<|oYmUh|ayMKa!gl6MJp@Af-D)-J_H}lVr zpXs}#zW=`d{biRWciE)$MSGYUClojdAZ;wmo_w6}di_Y4)70R@YwFGu<}W<@NdZk*^aEr1h~q%DAJx zp|vu_ooQ3tYnE>+uT9+&wENc0_zWzGn0NdWR)4p1{CGfvl zJNfG^^$pBxt`{=h-ncdBT6WI?56+weMQcIId8@j;Vvhe<&L1S!GX*FgTe~DWM4fLt7qd literal 0 HcmV?d00001 diff --git a/src/res/arrowLeft.png b/src/res/arrowLeft.png new file mode 100644 index 0000000000000000000000000000000000000000..dcdea7ef0bef65fd662cb40c0e6838be3bd966b0 GIT binary patch literal 713 zcmeAS@N?(olHy`uVBq!ia0vp^(|~ve2OE%N;})0%q!^2X+?^QKos)S9a~60+7Besim4Gngy)^j>1_q`$PZ!6KinzD80==XYCE70D&@E-Yx9icp zU5)Eb&N6BgFq-W4yz}e-^Nk4yxLM`z=VHie-8g$A9yxt$A)c9 zLRTO2h+f;eg5|4e8`tY7hv@W)=L(h=60T*}2mfb(xnCzj^3ICvQj^jM_2|aA_4!W(zL{OsjM*&K z^Z7^Np(vThn>>CCUSn;1d)W9I@A6`eZNE9XTY^2DB2-#j2Pg5M;0N=(+jAHl{wUV~ PlOKbptDnm{r-UW|-R1~F literal 0 HcmV?d00001 diff --git a/src/res/arrowRight.png b/src/res/arrowRight.png new file mode 100644 index 0000000000000000000000000000000000000000..f8bb58afdd0b39f96e37ae4348b5d95853d3b921 GIT binary patch literal 711 zcmeAS@N?(olHy`uVBq!ia0vp^(|~ve2OE%N;})0%q!^2X+?^QKos)S9a~60+7Besim4Gngy)^j>1_q`WPZ!6KinzD89Q%Y4C0qk<>F#7)zV60K z=>p%}|6DJFR%SKsN{ue{b4obYF#EgUq067Uh1a|}{8KVaRY&NMlH%Yb)=1a>`t$a9 zbE^M&{d4Op4{u$tukL3>-O(vWt0u7S_KVOKys^HeboowUjdkrZYGhun+*}dl{ z?yrAqwx-H*ovZSOaKDFLZVtr^mMLyxdkk$QeDH&`O0ef2e;|P8p~1-DLoXKBp}9_IB^gXjhA0qFOZwJjOFh( RV4`DS@O1TaS?83{1OSSu^x^;j literal 0 HcmV?d00001 diff --git a/src/res/arrowUp.png b/src/res/arrowUp.png new file mode 100644 index 0000000000000000000000000000000000000000..5f888377436ba324c43e04d41cbe0750f90e4756 GIT binary patch literal 687 zcmeAS@N?(olHy`uVBq!ia0vp^Gk|y+2OE%7I^h@yq!^2X+?^QKos)S9a~60+7Besim4Gngy)^j>1_mYgTe~ HDWM4faz)wp literal 0 HcmV?d00001 diff --git a/src/src/FormBattleship.java b/src/src/FormBattleship.java index 43bf77a..f6b0df2 100644 --- a/src/src/FormBattleship.java +++ b/src/src/FormBattleship.java @@ -28,17 +28,17 @@ public class FormBattleship extends JFrame { Height = getHeight() - 35; CreateButton.setName("CREATE"); - Icon iconUp = new ImageIcon("C:\\Users\\Админ\\Downloads\\arrowUp.png"); + Icon iconUp = new ImageIcon("src/res/arrowUp.png"); UpButton.setIcon(iconUp); UpButton.setName("Up"); DownButton.setName("Down"); - Icon iconDown = new ImageIcon("C:\\Users\\Админ\\Downloads\\arrowDown.png"); + Icon iconDown = new ImageIcon("src/res/arrowDown.png"); DownButton.setIcon(iconDown); LeftButton.setName("Left"); - Icon iconLeft = new ImageIcon("C:\\Users\\Админ\\Downloads\\arrowLeft.png"); + Icon iconLeft = new ImageIcon("src/res/arrowLeft.png"); LeftButton.setIcon(iconLeft); RightButton.setName("Right"); - Icon iconRight = new ImageIcon("C:\\Users\\Админ\\Downloads\\arrowRight.png"); + Icon iconRight = new ImageIcon("src/res/arrowRight.png"); RightButton.setIcon(iconRight); CreateButton.addActionListener(new ActionListener() { -- 2.25.1