diff --git a/src/main/java/PingPong/GamePanel.java b/src/main/java/PingPong/GamePanel.java index 8c6e88a..8a128f7 100644 --- a/src/main/java/PingPong/GamePanel.java +++ b/src/main/java/PingPong/GamePanel.java @@ -2,6 +2,8 @@ package PingPong; import javax.swing.*; import java.awt.*; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; import java.util.Random; @@ -21,9 +23,12 @@ public class GamePanel extends JPanel implements Runnable { Image image; Graphics graphics; + + public void run() { + } public void draw(Graphics g) { score.draw(g); @@ -44,6 +49,14 @@ public class GamePanel extends JPanel implements Runnable { ball = new Ball((FRAME_WIDTH/2)-(BALL_DIAMETER/2), ((FRAME_HEIGHT/2)-(BALL_DIAMETER/2)), BALL_DIAMETER, BALL_DIAMETER); } + public class AL extends KeyAdapter { + + public void keyPressed(KeyEvent e) { + paddle_1.pressed(e); + paddle_2.pressed(e); + } + } + diff --git a/src/main/java/PingPong/Paddle.java b/src/main/java/PingPong/Paddle.java index dc71933..5613614 100644 --- a/src/main/java/PingPong/Paddle.java +++ b/src/main/java/PingPong/Paddle.java @@ -1,8 +1,12 @@ package PingPong; import java.awt.*; +import java.awt.event.KeyEvent; public class Paddle { public void draw(Graphics g) { } + + public void pressed(KeyEvent e) { + } }