|
@ -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() { |
|
|
|
|
|
|
|
|