From 0db5c98d2d4a6d9605ba77fef6389f2f6d831338 Mon Sep 17 00:00:00 2001 From: dimazhelovanov Date: Mon, 24 Oct 2022 20:59:27 +0300 Subject: [PATCH 1/4] =?UTF-8?q?=D0=92=D1=82=D0=BE=D1=80=D0=BE=D0=B9=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=BC=D0=B8=D1=82.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FormBattleship.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/FormBattleship.java b/FormBattleship.java index cb3aa2e..127eb33 100644 --- a/FormBattleship.java +++ b/FormBattleship.java @@ -1,5 +1,15 @@ -public class FormBattleship { - public static void main(String[] args) { +import javax.swing.*; +import java.awt.*; +import java.awt.event.ComponentEvent; +import java.awt.event.ComponentListener; +import java.util.Random; +public class FormBattleship extends JComponent { + private DrawningBattleship _battleship; + private EntityBattleship _entityBattleship; + public static void main(String[] args) { + FormBattleship formBattleship = new FormBattleship(); + } + public FormBattleship() { } } -- 2.25.1 From de8c7eb3aeddfad9efbe3aa76c7b34be6f51ecef Mon Sep 17 00:00:00 2001 From: dimazhelovanov Date: Mon, 24 Oct 2022 21:01:54 +0300 Subject: [PATCH 2/4] =?UTF-8?q?=D0=92=D1=82=D0=BE=D1=80=D0=BE=D0=B9=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=BC=D0=B8=D1=82.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Direction.java | 7 ++ DrawningBattleship.java | 169 ++++++++++++++++++++++++++++++++++++++++ EntityBattleship.java | 41 ++++++++++ 3 files changed, 217 insertions(+) create mode 100644 Direction.java create mode 100644 DrawningBattleship.java create mode 100644 EntityBattleship.java diff --git a/Direction.java b/Direction.java new file mode 100644 index 0000000..d4a5659 --- /dev/null +++ b/Direction.java @@ -0,0 +1,7 @@ +public enum Direction { + + Up, + Down, + Left, + Right +} diff --git a/DrawningBattleship.java b/DrawningBattleship.java new file mode 100644 index 0000000..20928c2 --- /dev/null +++ b/DrawningBattleship.java @@ -0,0 +1,169 @@ +import java.awt.*; + +public class DrawningBattleship { + EntityBattleship Battleship; + public EntityBattleship Battleship() + {return Battleship; } + /// + /// Левая координата отрисовки корабля + /// + private float _startPosX; + /// + /// Верхняя кооридната отрисовки корабля + /// + private float _startPosY; + /// + /// Ширина окна отрисовки + /// + private Integer _pictureWidth = 100; + /// + /// Высота окна отрисовки + /// + private Integer _pictureHeight = 100; + /// + /// Ширина отрисовки корабля + /// + private final int _battleshipWidth = 120; + /// + /// Высота отрисовки корабля + /// + private final int _battleshipHeight = 50; + /// + /// Инициализация свойств + /// + /// Скорость + /// Вес корабля + /// Цвет корпуса + public void Init(int speed, float weight, Color bodyColor, EntityBattleship entityBattleship) + { + Battleship = new EntityBattleship(); + Battleship.Init(speed, weight, bodyColor); + } + /// + /// Установка позиции корабля + /// + /// Координата X + /// Координата Y + /// Ширина картинки + /// Высота картинки + public void SetPosition(int x, int y, int width, int height) + { + + if ((x > 0 && y > 0) && (_battleshipHeight + y < height) && (_battleshipWidth + x < width)) + { + _startPosX = x; + _startPosY = y; + _pictureWidth = width; + _pictureHeight = height; + } + + } + /// + /// Изменение направления перемещения + /// + /// Направление + public void MoveTransport(Direction direction) + { + if (_pictureWidth == null || _pictureHeight == null) + { + return; + } + switch (direction) + { + // вправо + case Right: + if (_startPosX + _battleshipWidth + Battleship.GetStep() < _pictureWidth) + { + _startPosX += Battleship.GetStep(); + } + break; + //влево + case Left: + if (_startPosX - Battleship.GetStep() >= 0) + { + _startPosX -= Battleship.GetStep(); + } + break; + + //вверх + case Up: + if (_startPosY - Battleship.GetStep() >= 0) + { + _startPosY -= Battleship.GetStep(); + } + break; + //вниз + case Down: + if (_startPosY + _battleshipHeight + Battleship.GetStep() < _pictureHeight) + { + _startPosY += Battleship.GetStep(); + } + break; + } + } + /// + /// Отрисовка корабля + /// + /// + public void DrawTransport(Graphics g) + { + if (_startPosX < 0 || _startPosY < 0 + || _pictureHeight == null || _pictureWidth == null) + { + return; + } + g.setColor(Color.BLACK); + + //Корпус корабля + //Brush br = new SolidBrush(Battleship?.BodyColor ?? Color.Black); + // Polygon[] shipHullArrayPoints = {((int)_startPosX, (int)_startPosY)), (int)_startPosX, (int)_startPosY + 50), new Point((int)_startPosX + 80, (int)_startPosY + 50), + //(int)_startPosX + 120, (int)_startPosY + 25 ), new Point((int)_startPosX + 80, (int)_startPosY), new Point((int)_startPosX, (int)_startPosY)}; + g.setColor(Battleship.BodyColor); + g.fillPolygon(new int[]{(int) _startPosX, (int) _startPosX , (int) _startPosX+80, (int) _startPosX + 120, (int)_startPosX + 80, (int)_startPosX}, + new int[]{(int) _startPosY, (int) _startPosY+50 , (int) _startPosY+50, (int) _startPosX + 25, (int)_startPosY, (int)_startPosY}, 6); + + //Пушка + + g.setColor(Color.BLACK); + g.drawRect((int)_startPosX + 20, (int)_startPosY + 20, 30, 10); + g.drawRect((int)_startPosX + 50,(int) _startPosY + 10, 20, 30); + g.fillRect((int)_startPosX + 20, (int)_startPosY + 20, 30, 10); + g.fillRect((int)_startPosX + 50, (int)_startPosY + 10, 20, 30); + + //Отсек + g.setColor(Color.BLUE); + g.drawOval((int)_startPosX+80, (int)_startPosY+15, 20, 20); + g.fillOval((int)_startPosX + 80, (int)_startPosY + 15, 20, 20); + g.setColor(Color.BLACK); + g.fillRect((int)_startPosX-5, (int)_startPosY+10, 5, 5); + g.fillRect((int)_startPosX - 5, (int)_startPosY + 35, 5, 5); + + } + /// + /// Смена границ формы отрисовки + /// + /// Ширина картинки + /// Высота картинки + + + public void ChangeBorders(int width, int height) + { + _pictureWidth = width; + _pictureHeight = height; + if (_pictureWidth <= _battleshipWidth || _pictureHeight <= _battleshipHeight) + { + _pictureWidth = null; + _pictureHeight = null; + return; + } + if (_startPosX + _battleshipWidth > _pictureWidth) + { + _startPosX = _pictureWidth - _battleshipWidth; + } + if (_startPosY + _battleshipHeight > _pictureHeight) + { + _startPosY = _pictureHeight - _battleshipHeight; + } + } + +} diff --git a/EntityBattleship.java b/EntityBattleship.java new file mode 100644 index 0000000..0674e77 --- /dev/null +++ b/EntityBattleship.java @@ -0,0 +1,41 @@ +import java.awt.*; +import java.util.Random; + +public class EntityBattleship { + private int speed; + private float weight; + Color BodyColor; + public int GetSpeed() { + return speed; + } + public float GetWeight() { + return weight; + } + /// + /// Цвет корпуса + /// + public Color GetBodyColor() { + return BodyColor; + } + /// + /// Шаг перемещения корабля + /// + public float GetStep(){ + return speed * 100 / weight; + } + /// + /// Инициализация полей объекта-класса корабля + /// + /// + /// + /// + /// + public void Init(int speed, float weight, Color bodyColor) + { + Random rnd = new Random(); + if(speed <= 0) speed = rnd.nextInt(50, 150); + if(weight <= 0) weight = rnd.nextInt(40, 70); + + BodyColor = bodyColor; + } +} -- 2.25.1 From 33ef22cccc7f64aace4193f503375b215938b53b Mon Sep 17 00:00:00 2001 From: dimazhelovanov Date: Mon, 21 Nov 2022 22:52:48 +0300 Subject: [PATCH 3/4] =?UTF-8?q?=D0=A1=D0=B4=D0=B5=D0=BB=D0=B0=D0=BD=D0=BD?= =?UTF-8?q?=D0=B0=D1=8F=20=D0=BB=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=BD=D0=B0=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DirectionBlocksOnDeck.java | 5 ++ DrawningBattleship.java | 18 ++++--- DrawningBlocks.java | 43 +++++++++++++++ EntityBattleship.java | 15 +++--- FormBattleship.java | 104 +++++++++++++++++++++++++++++++++++++ 5 files changed, 171 insertions(+), 14 deletions(-) create mode 100644 DirectionBlocksOnDeck.java create mode 100644 DrawningBlocks.java diff --git a/DirectionBlocksOnDeck.java b/DirectionBlocksOnDeck.java new file mode 100644 index 0000000..65d9a7e --- /dev/null +++ b/DirectionBlocksOnDeck.java @@ -0,0 +1,5 @@ +public enum DirectionBlocksOnDeck { + Two, + Four, + Six +} diff --git a/DrawningBattleship.java b/DrawningBattleship.java index 20928c2..0d46b47 100644 --- a/DrawningBattleship.java +++ b/DrawningBattleship.java @@ -2,6 +2,7 @@ import java.awt.*; public class DrawningBattleship { EntityBattleship Battleship; + private DrawningBlocks drawingBlocks; public EntityBattleship Battleship() {return Battleship; } /// @@ -15,11 +16,11 @@ public class DrawningBattleship { /// /// Ширина окна отрисовки /// - private Integer _pictureWidth = 100; + private Integer _pictureWidth = null; /// /// Высота окна отрисовки /// - private Integer _pictureHeight = 100; + private Integer _pictureHeight = null; /// /// Ширина отрисовки корабля /// @@ -34,10 +35,12 @@ public class DrawningBattleship { /// Скорость /// Вес корабля /// Цвет корпуса - public void Init(int speed, float weight, Color bodyColor, EntityBattleship entityBattleship) + public void Init(int speed, float weight, Color bodyColor, EntityBattleship entityBattleship, int blocks) { Battleship = new EntityBattleship(); Battleship.Init(speed, weight, bodyColor); + drawingBlocks = new DrawningBlocks(); + drawingBlocks.Init(blocks, Color.black); } /// /// Установка позиции корабля @@ -83,6 +86,7 @@ public class DrawningBattleship { { _startPosX -= Battleship.GetStep(); } + break; //вверх @@ -91,6 +95,7 @@ public class DrawningBattleship { { _startPosY -= Battleship.GetStep(); } + break; //вниз case Down: @@ -105,7 +110,7 @@ public class DrawningBattleship { /// Отрисовка корабля /// /// - public void DrawTransport(Graphics g) + public void DrawTransport(Graphics2D g) { if (_startPosX < 0 || _startPosY < 0 || _pictureHeight == null || _pictureWidth == null) @@ -118,9 +123,9 @@ public class DrawningBattleship { //Brush br = new SolidBrush(Battleship?.BodyColor ?? Color.Black); // Polygon[] shipHullArrayPoints = {((int)_startPosX, (int)_startPosY)), (int)_startPosX, (int)_startPosY + 50), new Point((int)_startPosX + 80, (int)_startPosY + 50), //(int)_startPosX + 120, (int)_startPosY + 25 ), new Point((int)_startPosX + 80, (int)_startPosY), new Point((int)_startPosX, (int)_startPosY)}; - g.setColor(Battleship.BodyColor); + g.setColor(Battleship.bodyColor); g.fillPolygon(new int[]{(int) _startPosX, (int) _startPosX , (int) _startPosX+80, (int) _startPosX + 120, (int)_startPosX + 80, (int)_startPosX}, - new int[]{(int) _startPosY, (int) _startPosY+50 , (int) _startPosY+50, (int) _startPosX + 25, (int)_startPosY, (int)_startPosY}, 6); + new int[]{(int) _startPosY, (int) _startPosY+50 , (int) _startPosY+50, (int) _startPosY + 25, (int)_startPosY, (int)_startPosY}, 6); //Пушка @@ -137,6 +142,7 @@ public class DrawningBattleship { g.setColor(Color.BLACK); g.fillRect((int)_startPosX-5, (int)_startPosY+10, 5, 5); g.fillRect((int)_startPosX - 5, (int)_startPosY + 35, 5, 5); + drawingBlocks.Draw(g, (int) _startPosX, (int) _startPosY); } /// diff --git a/DrawningBlocks.java b/DrawningBlocks.java new file mode 100644 index 0000000..7e21e7e --- /dev/null +++ b/DrawningBlocks.java @@ -0,0 +1,43 @@ +import java.awt.*; + +public class DrawningBlocks { + private DirectionBlocksOnDeck blocksCount; + private Color color; + public void SetNewBlocks(int countBlocks){ + if (countBlocks == 4) { + blocksCount = DirectionBlocksOnDeck.Four; + } else if (countBlocks == 6) { + blocksCount = DirectionBlocksOnDeck.Six; + } + else { + blocksCount = DirectionBlocksOnDeck.Two; + } + + + } + public void Init(int blocksCount, Color color) + { + SetNewBlocks(blocksCount); + this.color = color; + } + public void Draw(Graphics2D g, int x, int y) { + g.setColor(color != null ? color : Color.BLACK); + switch (blocksCount) { + case Four -> { + g.fillRect(x + 26, y + 10, 10, 5); + g.fillRect(x + 38, y + 10, 10, 5); + g.fillRect(x + 38, y + 35, 10, 5); + g.fillRect(x + 26, y + 35, 10, 5); + } + case Six -> { + g.fillRect(x + 14, y + 10, 10, 5); + g.fillRect(x + 26, y + 10, 10, 5); + g.fillRect(x + 38, y + 10, 10, 5); + g.fillRect(x + 38, y + 35, 10, 5); + g.fillRect(x + 26, y + 35, 10, 5); + g.fillRect(x + 14, y + 35, 10, 5); + + } + } + } +} diff --git a/EntityBattleship.java b/EntityBattleship.java index 0674e77..7f26f3e 100644 --- a/EntityBattleship.java +++ b/EntityBattleship.java @@ -2,9 +2,9 @@ import java.awt.*; import java.util.Random; public class EntityBattleship { - private int speed; - private float weight; - Color BodyColor; + private int speed = 0; + private float weight = 0; + Color bodyColor; public int GetSpeed() { return speed; } @@ -15,7 +15,7 @@ public class EntityBattleship { /// Цвет корпуса /// public Color GetBodyColor() { - return BodyColor; + return bodyColor; } /// /// Шаг перемещения корабля @@ -33,9 +33,8 @@ public class EntityBattleship { public void Init(int speed, float weight, Color bodyColor) { Random rnd = new Random(); - if(speed <= 0) speed = rnd.nextInt(50, 150); - if(weight <= 0) weight = rnd.nextInt(40, 70); - - BodyColor = bodyColor; + this.speed = speed <= 0 ? rnd.nextInt(950) + 1050 : speed; + this.weight = weight <= 0 ? rnd.nextInt(40) + 70 : weight; + this.bodyColor = bodyColor; } } diff --git a/FormBattleship.java b/FormBattleship.java index 127eb33..f0d9d81 100644 --- a/FormBattleship.java +++ b/FormBattleship.java @@ -1,5 +1,7 @@ import javax.swing.*; import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.util.Random; @@ -11,5 +13,107 @@ public class FormBattleship extends JComponent { FormBattleship formBattleship = new FormBattleship(); } public FormBattleship() { + JFrame form = new JFrame("Военный корабль"); + form.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + form.setSize(800, 500); + form.setVisible(true); + form.setLocationRelativeTo(null); + form.addComponentListener(new ComponentListener() { + @Override + public void componentResized(ComponentEvent e) { + if(_battleship != null) _battleship.ChangeBorders(getWidth(), getHeight()); + repaint(); + } + + @Override + public void componentMoved(ComponentEvent e) { + + } + + @Override + public void componentShown(ComponentEvent e) { + + } + + @Override + public void componentHidden(ComponentEvent e) { + + } + }); + + Panel statusPanel = new Panel(); + statusPanel.setBackground(Color.WHITE); + statusPanel.setLayout(new FlowLayout()); + setLayout(new BorderLayout()); + form.add(statusPanel, BorderLayout.SOUTH); + Label speedLabel = new Label("Скорость: "); + Label weightLabel = new Label("Вес: "); + Label colorLabel = new Label("Цвет: "); + + + JButton createButton = new JButton("Создать"); + createButton.addActionListener(e -> { + int[] countBlocks = {2, 4, 6}; + Random rnd = new Random(); + + _battleship = new DrawningBattleship(); + _battleship.Init(rnd.nextInt(100, 300), rnd.nextInt(1000, 2000), + Color.getHSBColor(rnd.nextInt(0, 256), rnd.nextInt(0, 256), + rnd.nextInt(0, 256)), _entityBattleship, countBlocks[rnd.nextInt(0, 3)]); + _battleship.SetPosition(10 + rnd.nextInt(90), 10 + rnd.nextInt(90), form.getWidth(), form.getHeight() - 75); + speedLabel.setText("Скорость: " + _battleship.Battleship.GetSpeed()); + weightLabel.setText("Вес: " + (int)_battleship.Battleship.GetWeight()); + colorLabel.setText("Цвет: " + _battleship.Battleship.GetBodyColor().getRed() + " " + + _battleship.Battleship.GetBodyColor().getGreen() + " " + _battleship.Battleship.GetBodyColor().getBlue() ); + + repaint(); + + + }); + statusPanel.add(createButton); + statusPanel.add(speedLabel); + statusPanel.add(weightLabel); + statusPanel.add(colorLabel); + JButton upButton = new JButton("↑"); + JButton rightButton = new JButton("→"); + JButton leftButton = new JButton("←"); + JButton downButton = new JButton("↓"); + upButton.addActionListener(e -> { + if (_battleship != null) _battleship.MoveTransport(Direction.Up); + repaint(); + }); + + + rightButton.addActionListener(e -> { + if (_battleship != null) _battleship.MoveTransport(Direction.Right); + repaint(); + }); + + + leftButton.addActionListener(e -> { + if (_battleship != null) _battleship.MoveTransport(Direction.Left); + repaint(); + }); + + + downButton.addActionListener(e -> { + if (_battleship != null) _battleship.MoveTransport(Direction.Down); + repaint(); + }); + + + statusPanel.add(leftButton); + statusPanel.add(upButton); + statusPanel.add(rightButton); + statusPanel.add(downButton); + + form.getContentPane().add(this); } + protected void paintComponent(Graphics g) { + super.paintComponent(g); + Graphics2D g2 = (Graphics2D)g; + if (_battleship != null) _battleship.DrawTransport(g2); + super.repaint(); + } + } -- 2.25.1 From 92be17d6f63f21e99a00a03d468b236fd77486f7 Mon Sep 17 00:00:00 2001 From: dimazhelovanov Date: Thu, 1 Dec 2022 23:26:38 +0300 Subject: [PATCH 4/4] =?UTF-8?q?=D0=9F=D1=80=D0=B8=D0=BD=D1=8F=D1=82=D0=B0?= =?UTF-8?q?=D1=8F=20=D0=BB=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D0=BD=D0=B0=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Direction.java | 1 - DrawningBattleship.java | 8 -------- DrawningBlocks.java | 3 --- FormBattleship.java | 8 -------- 4 files changed, 20 deletions(-) diff --git a/Direction.java b/Direction.java index d4a5659..a641b80 100644 --- a/Direction.java +++ b/Direction.java @@ -1,5 +1,4 @@ public enum Direction { - Up, Down, Left, diff --git a/DrawningBattleship.java b/DrawningBattleship.java index 0d46b47..3bc4844 100644 --- a/DrawningBattleship.java +++ b/DrawningBattleship.java @@ -120,15 +120,10 @@ public class DrawningBattleship { g.setColor(Color.BLACK); //Корпус корабля - //Brush br = new SolidBrush(Battleship?.BodyColor ?? Color.Black); - // Polygon[] shipHullArrayPoints = {((int)_startPosX, (int)_startPosY)), (int)_startPosX, (int)_startPosY + 50), new Point((int)_startPosX + 80, (int)_startPosY + 50), - //(int)_startPosX + 120, (int)_startPosY + 25 ), new Point((int)_startPosX + 80, (int)_startPosY), new Point((int)_startPosX, (int)_startPosY)}; g.setColor(Battleship.bodyColor); g.fillPolygon(new int[]{(int) _startPosX, (int) _startPosX , (int) _startPosX+80, (int) _startPosX + 120, (int)_startPosX + 80, (int)_startPosX}, new int[]{(int) _startPosY, (int) _startPosY+50 , (int) _startPosY+50, (int) _startPosY + 25, (int)_startPosY, (int)_startPosY}, 6); - //Пушка - g.setColor(Color.BLACK); g.drawRect((int)_startPosX + 20, (int)_startPosY + 20, 30, 10); g.drawRect((int)_startPosX + 50,(int) _startPosY + 10, 20, 30); @@ -150,8 +145,6 @@ public class DrawningBattleship { /// /// Ширина картинки /// Высота картинки - - public void ChangeBorders(int width, int height) { _pictureWidth = width; @@ -171,5 +164,4 @@ public class DrawningBattleship { _startPosY = _pictureHeight - _battleshipHeight; } } - } diff --git a/DrawningBlocks.java b/DrawningBlocks.java index 7e21e7e..61b2d20 100644 --- a/DrawningBlocks.java +++ b/DrawningBlocks.java @@ -12,8 +12,6 @@ public class DrawningBlocks { else { blocksCount = DirectionBlocksOnDeck.Two; } - - } public void Init(int blocksCount, Color color) { @@ -36,7 +34,6 @@ public class DrawningBlocks { g.fillRect(x + 38, y + 35, 10, 5); g.fillRect(x + 26, y + 35, 10, 5); g.fillRect(x + 14, y + 35, 10, 5); - } } } diff --git a/FormBattleship.java b/FormBattleship.java index f0d9d81..cf501cc 100644 --- a/FormBattleship.java +++ b/FormBattleship.java @@ -5,7 +5,6 @@ import java.awt.event.ActionListener; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.util.Random; - public class FormBattleship extends JComponent { private DrawningBattleship _battleship; private EntityBattleship _entityBattleship; @@ -27,20 +26,16 @@ public class FormBattleship extends JComponent { @Override public void componentMoved(ComponentEvent e) { - } @Override public void componentShown(ComponentEvent e) { - } @Override public void componentHidden(ComponentEvent e) { - } }); - Panel statusPanel = new Panel(); statusPanel.setBackground(Color.WHITE); statusPanel.setLayout(new FlowLayout()); @@ -65,10 +60,8 @@ public class FormBattleship extends JComponent { weightLabel.setText("Вес: " + (int)_battleship.Battleship.GetWeight()); colorLabel.setText("Цвет: " + _battleship.Battleship.GetBodyColor().getRed() + " " + _battleship.Battleship.GetBodyColor().getGreen() + " " + _battleship.Battleship.GetBodyColor().getBlue() ); - repaint(); - }); statusPanel.add(createButton); statusPanel.add(speedLabel); @@ -101,7 +94,6 @@ public class FormBattleship extends JComponent { repaint(); }); - statusPanel.add(leftButton); statusPanel.add(upButton); statusPanel.add(rightButton); -- 2.25.1