Browse Source

update

main
fdai4616 2 years ago
parent
commit
625f2a29ce
  1. 8
      src/main/java/PingPong/GamePanel.java

8
src/main/java/PingPong/GamePanel.java

@ -18,6 +18,8 @@ public class GamePanel extends JPanel implements Runnable {
Paddle paddle_1; Paddle paddle_1;
Paddle paddle_2; Paddle paddle_2;
Score score; Score score;
Image image;
Graphics graphics;
public void run() { public void run() {
@ -30,6 +32,12 @@ public class GamePanel extends JPanel implements Runnable {
ball.draw(g); ball.draw(g);
} }
public void paint(Graphics g) {
image = createImage(getWidth(), getHeight());
graphics = image.getGraphics();
draw(graphics);
g.drawImage(image, 0, 0, this);
}
public void newBall() { public void newBall() {

Loading…
Cancel
Save