From 6b17f1e8a96e685c20d5ce2a875abe5ff35bcaeb Mon Sep 17 00:00:00 2001 From: fdai7551 Date: Thu, 2 Feb 2023 10:49:22 +0100 Subject: [PATCH] refactoring:[SnakeGame Class]: xCords2 ausgelagert --- .../JavaGamelauncher/SnakeGame.java | 82 ++----------------- 1 file changed, 6 insertions(+), 76 deletions(-) diff --git a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/SnakeGame.java b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/SnakeGame.java index 9e8560f..9b41848 100644 --- a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/SnakeGame.java +++ b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/SnakeGame.java @@ -103,7 +103,7 @@ public class SnakeGame extends JFrame { cP.add(panel1); panel2 = new JPanel(); - panel2.setBounds(400, 0, 100, 100); + panel2.setBounds(xCords2, 0, 100, 100); panel2.setVisible(true); panel2.setBackground(Color.BLACK); @@ -145,7 +145,7 @@ public class SnakeGame extends JFrame { cP.add(panel7); panel8 = new JPanel(); - panel8.setBounds(400, 100, 100, 100); + panel8.setBounds(xCords2, 100, 100, 100); panel8.setVisible(true); panel8.setBackground(Color.BLUE); @@ -187,77 +187,7 @@ public class SnakeGame extends JFrame { cP.add(panel13); panel14 = new JPanel(); - panel14.setBounds(400, 200, 100, 100); - panel14.setVisible(true); - panel14.setBackground(Color.WHITE); - - cP.add(panel14); - - panel15 = new JPanel(); - panel15.setBounds(500, 200, 100, 100); - panel15.setVisible(true); - panel15.setBackground(Color.BLACK); - - cP.add(panel15); - - panel16 = new JPanel(); - panel16.setBounds(600, 200, 100, 100); - panel16.setVisible(true); - panel16.setBackground(Color.BLACK); - - cP.add(panel16); - - panel17 = new JPanel(); - panel17.setBounds(700, 200, 100, 100); - panel17.setVisible(true); - panel17.setBackground(Color.BLACK); - - cP.add(panel17); - - panel18 = new JPanel(); - panel18.setBounds(800, 200, 100, 100); - panel18.setVisible(true); - panel18.setBackground(Color.BLACK); - - cP.add(panel18); - - panel9 = new JPanel(); - panel9.setBounds(500, 100, 100, 100); - panel9.setVisible(true); - panel9.setBackground(Color.BLACK); - - cP.add(panel9); - - panel10 = new JPanel(); - panel10.setBounds(600, 100, 100, 100); - panel10.setVisible(true); - panel10.setBackground(Color.BLACK); - - cP.add(panel10); - - panel11 = new JPanel(); - panel11.setBounds(700, 100, 100, 100); - panel11.setVisible(true); - panel11.setBackground(Color.BLACK); - - cP.add(panel11); - - panel12 = new JPanel(); - panel12.setBounds(800, 100, 100, 100); - panel12.setVisible(true); - panel12.setBackground(Color.BLACK); - - cP.add(panel12); - - panel13 = new JPanel(); - panel13.setBounds(xCords1, 200, 100, 100); - panel13.setVisible(true); - panel13.setBackground(Color.BLACK); - - cP.add(panel13); - - panel14 = new JPanel(); - panel14.setBounds(400, 200, 100, 100); + panel14.setBounds(xCords2, 200, 100, 100); panel14.setVisible(true); panel14.setBackground(Color.WHITE); @@ -299,7 +229,7 @@ public class SnakeGame extends JFrame { cP.add(panel19); panel20 = new JPanel(); - panel20.setBounds(400, 300, 100, 100); + panel20.setBounds(xCords2, 300, 100, 100); panel20.setVisible(true); panel20.setBackground(Color.WHITE); @@ -341,7 +271,7 @@ public class SnakeGame extends JFrame { cP.add(panel25); panel26 = new JPanel(); - panel26.setBounds(400, 400, 100, 100); + panel26.setBounds(xCords2, 400, 100, 100); panel26.setVisible(true); panel26.setBackground(Color.BLACK); @@ -383,7 +313,7 @@ public class SnakeGame extends JFrame { cP.add(panel31); panel32 = new JPanel(); - panel32.setBounds(400, 500, 100, 100); + panel32.setBounds(xCords2, 500, 100, 100); panel32.setVisible(true); panel32.setBackground(Color.BLACK);