|
|
@ -4,6 +4,7 @@ import javax.swing.*; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.event.KeyAdapter; |
|
|
|
import java.awt.event.KeyEvent; |
|
|
|
import java.util.Random; |
|
|
|
|
|
|
|
|
|
|
|
public class GamePanel extends JPanel implements Runnable { |
|
|
@ -14,7 +15,7 @@ public class GamePanel extends JPanel implements Runnable { |
|
|
|
static final int PADDLE_HEIGHT = 100; |
|
|
|
public static final Dimension SCREEN = new Dimension(FRAME_WIDTH, FRAME_HEIGHT); |
|
|
|
|
|
|
|
|
|
|
|
Random random; |
|
|
|
Ball ball; |
|
|
|
Paddle paddle_1; |
|
|
|
Paddle paddle_2; |
|
|
@ -154,12 +155,12 @@ public class GamePanel extends JPanel implements Runnable { |
|
|
|
paddle_1.pressed(e); |
|
|
|
paddle_2.pressed(e); |
|
|
|
} |
|
|
|
} |
|
|
|
public void keyReleased(KeyEvent e) { |
|
|
|
paddle_1.released(e); |
|
|
|
paddle_2.released(e); |
|
|
|
} |
|
|
|
|
|
|
|
public void keyReleased(KeyEvent e) { |
|
|
|
paddle_1.released(e); |
|
|
|
paddle_2.released(e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|