Simple Keyboard input?

I am a new programmer trying to create a simple keyboard input for a Jframe, if that is possible. Here is a simple jframe creation:

publicstaticvoid main(String[] args){

JFrame frame =new JFrame("Keyboard input");

frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

// make window visible

frame.pack();

frame.setVisible(true);

}

If I wanted to make a class that would put a ball in the frame and have the ball move up, down, left, or right according to which arrow keys were pressed and held- how would I do that?

Thanks for your help,

Sam

[897 byte] By [Eurypterida] at [2007-10-1 4:26:07]
# 1
See classes KeyListener and KeyAdapter And reed the Manual
mike_teplitskya at 2007-7-9 4:56:02 > top of Java-index,Archived Forums,Java 2 Software Development Kit (J2SE SDK)...