Browse Source

[SnakeGame Class]: hinzufügen der Panel 1&2

remotes/origin/SnakeGame
fdai7551 2 years ago
parent
commit
aacd3b55a4
  1. 20
      JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/SnakeGame.java

20
JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/SnakeGame.java

@ -36,6 +36,12 @@ import javax.swing.SwingConstants;
public class SnakeGame extends JFrame { public class SnakeGame extends JFrame {
private JPanel cP; private JPanel cP;
public JPanel panel1;
public JPanel panel2;
public int breite = 1200;
public int hoehe = 600;
public String titel = "Snake";
public static void main(String[] args) { public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() { EventQueue.invokeLater(new Runnable() {
@ -59,6 +65,20 @@ public class SnakeGame extends JFrame {
cP.setBorder(new EmptyBorder(5, 5, 5, 5)); cP.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(cP); setContentPane(cP);
cP.setLayout(null); cP.setLayout(null);
panel1 = new JPanel();
panel1.setBounds(300, 0, 100, 100);
panel1.setVisible(true);
panel1.setBackground(Color.BLACK);
cP.add(panel1);
panel2 = new JPanel();
panel2.setBounds(400, 0, 100, 100);
panel2.setVisible(true);
panel2.setBackground(Color.BLACK);
cP.add(panel2);
} }
} }
Loading…
Cancel
Save