Skip to content
Snippets Groups Projects
Commit ed2ec792 authored by bosskkev's avatar bosskkev
Browse files

Correction bug superposition

parent 4767ee5b
No related branches found
No related tags found
No related merge requests found
Pipeline #22751 failed
...@@ -24,16 +24,14 @@ public class Grid extends JFrame { ...@@ -24,16 +24,14 @@ public class Grid extends JFrame {
// this.setContentPane(mainPanel); // this.setContentPane(mainPanel);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setLocationRelativeTo(null); this.setLocationRelativeTo(null);
this.pack();
this.setResizable(false); this.setResizable(false);
this.setVisible(true); this.setVisible(true);
this.setLayout(this.getLayout());
kernel.start(); kernel.start();
kernel.setKeysListeners((JPanel) getContentPane()); kernel.setKeysListeners((JPanel) getContentPane());
this.pack();
this.revalidate(); this.revalidate();
} }
public void draw(ImageComponent ic) throws IOException { public void draw(ImageComponent ic) throws IOException {
getContentPane().add(ic); getContentPane().add(ic);
......
...@@ -16,7 +16,7 @@ public class ImageComponent extends JComponent { ...@@ -16,7 +16,7 @@ public class ImageComponent extends JComponent {
this.image = image; this.image = image;
this.position = position; this.position = position;
//this.setBorder(BorderFactory.createLineBorder(Color.black)); //this.setBorder(BorderFactory.createLineBorder(Color.black));
this.setSize(width, height); this.setSize(850, 500);
this.setVisible(true); this.setVisible(true);
this.setLayout(null); this.setLayout(null);
//repaint(); //repaint();
......
...@@ -20,9 +20,11 @@ public class PongApp { ...@@ -20,9 +20,11 @@ public class PongApp {
// TODO: Add rackets // TODO: Add rackets
PongBall pongBall = new PongBall("Ball", "src/main/resources/sprint2_demo/asteroid.png", new Coordinates2D(10, 10), 64, 64); PongBall pongBall = new PongBall("Ball", "src/main/resources/sprint2_demo/asteroid.png", new Coordinates2D(10, 10), 64, 64);
PongBall pongBall2 = new PongBall("Ball2", "src/main/resources/sprint2_demo/asteroid.png", new Coordinates2D(40, 40), 64, 64); PongBall pongBall2 = new PongBall("Ball2", "src/main/resources/sprint2_demo/asteroid.png", new Coordinates2D(40, 40), 64, 64);
PongBall pongBall3 = new PongBall("Ball3", "src/main/resources/sprint2_demo/asteroid.png", new Coordinates2D(70, 70), 64, 64);
components.add(pongBall); components.add(pongBall);
components.add(pongBall2); components.add(pongBall2);
components.add(pongBall3);
Grid grid = new Grid(); // Will create a new grid and a new kernel Grid grid = new Grid(); // Will create a new grid and a new kernel
grid.init("Pong", 850, 500); // Will start the kernel and set the keys listeners grid.init("Pong", 850, 500); // Will start the kernel and set the keys listeners
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment