|
@ -35,6 +35,24 @@ public class SnakeGame extends JFrame { |
|
|
public JPanel panel16; |
|
|
public JPanel panel16; |
|
|
public JPanel panel17; |
|
|
public JPanel panel17; |
|
|
public JPanel panel18; |
|
|
public JPanel panel18; |
|
|
|
|
|
public JPanel panel19; |
|
|
|
|
|
public JPanel panel20; |
|
|
|
|
|
public JPanel panel21; |
|
|
|
|
|
public JPanel panel22; |
|
|
|
|
|
public JPanel panel23; |
|
|
|
|
|
public JPanel panel24; |
|
|
|
|
|
public JPanel panel25; |
|
|
|
|
|
public JPanel panel26; |
|
|
|
|
|
public JPanel panel27; |
|
|
|
|
|
public JPanel panel28; |
|
|
|
|
|
public JPanel panel29; |
|
|
|
|
|
public JPanel panel30; |
|
|
|
|
|
public JPanel panel31; |
|
|
|
|
|
public JPanel panel32; |
|
|
|
|
|
public JPanel panel33; |
|
|
|
|
|
public JPanel panel34; |
|
|
|
|
|
public JPanel panel35; |
|
|
|
|
|
public JPanel panel36; |
|
|
|
|
|
|
|
|
public int breite = 1200; |
|
|
public int breite = 1200; |
|
|
public int hoehe = 600; |
|
|
public int hoehe = 600; |
|
@ -47,6 +65,12 @@ public class SnakeGame extends JFrame { |
|
|
public int breiteP3 = 100; |
|
|
public int breiteP3 = 100; |
|
|
public int hoeheP4 = 100; |
|
|
public int hoeheP4 = 100; |
|
|
public int breiteP4 = 100; |
|
|
public int breiteP4 = 100; |
|
|
|
|
|
public int xCords1 = 300; |
|
|
|
|
|
public int xCords2 = 400; |
|
|
|
|
|
public int xCords3 = 500; |
|
|
|
|
|
public int xCords4 = 600; |
|
|
|
|
|
public int xCords5 = 700; |
|
|
|
|
|
public int xCords6 = 800; |
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
public static void main(String[] args) { |
|
|
EventQueue.invokeLater(new Runnable() { |
|
|
EventQueue.invokeLater(new Runnable() { |
|
@ -196,6 +220,202 @@ public class SnakeGame extends JFrame { |
|
|
panel18.setBackground(Color.BLACK); |
|
|
panel18.setBackground(Color.BLACK); |
|
|
|
|
|
|
|
|
cP.add(panel18); |
|
|
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(300, 200, 100, 100); |
|
|
|
|
|
panel13.setVisible(true); |
|
|
|
|
|
panel13.setBackground(Color.BLACK); |
|
|
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
|
|
|
|
panel19 = new JPanel(); |
|
|
|
|
|
panel19.setBounds(300, 300, 100, 100); |
|
|
|
|
|
panel19.setVisible(true); |
|
|
|
|
|
panel19.setBackground(Color.BLACK); |
|
|
|
|
|
|
|
|
|
|
|
cP.add(panel19); |
|
|
|
|
|
|
|
|
|
|
|
panel20 = new JPanel(); |
|
|
|
|
|
panel20.setBounds(400, 300, 100, 100); |
|
|
|
|
|
panel20.setVisible(true); |
|
|
|
|
|
panel20.setBackground(Color.WHITE); |
|
|
|
|
|
|
|
|
|
|
|
cP.add(panel20); |
|
|
|
|
|
|
|
|
|
|
|
panel21 = new JPanel(); |
|
|
|
|
|
panel21.setBounds(500, 300, 100, 100); |
|
|
|
|
|
panel21.setVisible(true); |
|
|
|
|
|
panel21.setBackground(Color.BLACK); |
|
|
|
|
|
|
|
|
|
|
|
cP.add(panel21); |
|
|
|
|
|
|
|
|
|
|
|
panel22 = new JPanel(); |
|
|
|
|
|
panel22.setBounds(600, 300, 100, 100); |
|
|
|
|
|
panel22.setVisible(true); |
|
|
|
|
|
panel22.setBackground(Color.BLACK); |
|
|
|
|
|
|
|
|
|
|
|
cP.add(panel22); |
|
|
|
|
|
|
|
|
|
|
|
panel23 = new JPanel(); |
|
|
|
|
|
panel23.setBounds(700, 300, 100, 100); |
|
|
|
|
|
panel23.setVisible(true); |
|
|
|
|
|
panel23.setBackground(Color.BLACK); |
|
|
|
|
|
|
|
|
|
|
|
cP.add(panel23); |
|
|
|
|
|
|
|
|
|
|
|
panel24 = new JPanel(); |
|
|
|
|
|
panel24.setBounds(800, 300, 100, 100); |
|
|
|
|
|
panel24.setVisible(true); |
|
|
|
|
|
panel24.setBackground(Color.BLACK); |
|
|
|
|
|
|
|
|
|
|
|
cP.add(panel24); |
|
|
|
|
|
|
|
|
|
|
|
panel25 = new JPanel(); |
|
|
|
|
|
panel25.setBounds(300, 400, 100, 100); |
|
|
|
|
|
panel25.setVisible(true); |
|
|
|
|
|
panel25.setBackground(Color.BLACK); |
|
|
|
|
|
|
|
|
|
|
|
cP.add(panel25); |
|
|
|
|
|
|
|
|
|
|
|
panel26 = new JPanel(); |
|
|
|
|
|
panel26.setBounds(400, 400, 100, 100); |
|
|
|
|
|
panel26.setVisible(true); |
|
|
|
|
|
panel26.setBackground(Color.BLACK); |
|
|
|
|
|
|
|
|
|
|
|
cP.add(panel26); |
|
|
|
|
|
|
|
|
|
|
|
panel27 = new JPanel(); |
|
|
|
|
|
panel27.setBounds(500, 400, 100, 100); |
|
|
|
|
|
panel27.setVisible(true); |
|
|
|
|
|
panel27.setBackground(Color.BLACK); |
|
|
|
|
|
|
|
|
|
|
|
cP.add(panel27); |
|
|
|
|
|
|
|
|
|
|
|
panel28 = new JPanel(); |
|
|
|
|
|
panel28.setBounds(600, 400, 100, 100); |
|
|
|
|
|
panel28.setVisible(true); |
|
|
|
|
|
panel28.setBackground(Color.BLACK); |
|
|
|
|
|
|
|
|
|
|
|
cP.add(panel28); |
|
|
|
|
|
|
|
|
|
|
|
panel29 = new JPanel(); |
|
|
|
|
|
panel29.setBounds(700, 400, 100, 100); |
|
|
|
|
|
panel29.setVisible(true); |
|
|
|
|
|
panel29.setBackground(Color.BLACK); |
|
|
|
|
|
|
|
|
|
|
|
cP.add(panel29); |
|
|
|
|
|
|
|
|
|
|
|
panel30 = new JPanel(); |
|
|
|
|
|
panel30.setBounds(800, 400, 100, 100); |
|
|
|
|
|
panel30.setVisible(true); |
|
|
|
|
|
panel30.setBackground(Color.BLACK); |
|
|
|
|
|
|
|
|
|
|
|
cP.add(panel30); |
|
|
|
|
|
|
|
|
|
|
|
panel31 = new JPanel(); |
|
|
|
|
|
panel31.setBounds(300, 500, 100, 100); |
|
|
|
|
|
panel31.setVisible(true); |
|
|
|
|
|
panel31.setBackground(Color.BLACK); |
|
|
|
|
|
|
|
|
|
|
|
cP.add(panel31); |
|
|
|
|
|
|
|
|
|
|
|
panel32 = new JPanel(); |
|
|
|
|
|
panel32.setBounds(400, 500, 100, 100); |
|
|
|
|
|
panel32.setVisible(true); |
|
|
|
|
|
panel32.setBackground(Color.BLACK); |
|
|
|
|
|
|
|
|
|
|
|
cP.add(panel32); |
|
|
|
|
|
|
|
|
|
|
|
panel33 = new JPanel(); |
|
|
|
|
|
panel33.setBounds(500, 500, 100, 100); |
|
|
|
|
|
panel33.setVisible(true); |
|
|
|
|
|
panel33.setBackground(Color.BLACK); |
|
|
|
|
|
|
|
|
|
|
|
cP.add(panel33); |
|
|
|
|
|
|
|
|
|
|
|
panel34 = new JPanel(); |
|
|
|
|
|
panel34.setBounds(600, 500, 100, 100); |
|
|
|
|
|
panel34.setVisible(true); |
|
|
|
|
|
panel34.setBackground(Color.BLACK); |
|
|
|
|
|
|
|
|
|
|
|
cP.add(panel34); |
|
|
|
|
|
|
|
|
|
|
|
panel35 = new JPanel(); |
|
|
|
|
|
panel35.setBounds(700, 500, 100, 100); |
|
|
|
|
|
panel35.setVisible(true); |
|
|
|
|
|
panel35.setBackground(Color.BLACK); |
|
|
|
|
|
|
|
|
|
|
|
cP.add(panel35); |
|
|
|
|
|
|
|
|
|
|
|
panel36 = new JPanel(); |
|
|
|
|
|
panel36.setBounds(800, 500, 100, 100); |
|
|
|
|
|
panel36.setVisible(true); |
|
|
|
|
|
panel36.setBackground(Color.BLACK); |
|
|
|
|
|
|
|
|
|
|
|
cP.add(panel36); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public JPanel getPanel1() { |
|
|
public JPanel getPanel1() { |
|
|