Here is my code, what i'm trying to do is to move that rectangle with a key press. Questions - how do i specify it on arrow keys and why it won't allow me to work it that way? It underlines
my paddle object in red in KeyPressed event and won't run.
import acm.graphics.*;
import acm.program.*;
import java.awt.event.*;
public class BreakOut extends GraphicsProgram {
/** Runs the program */
public void run() {
GRect paddle = new GRect(200, 400, 100, 20);
add(paddle);
addKeyListeners();
}
public void keyPressed(KeyEvent e){
paddle.move(5,0);
}