OK, Java gurus. I have a swing application, one JFrame with two JPanels. One JPanel is a sort of drawing area, the other has some JButtons and TextFields and stuff.

Now my problem is, I want to use the spacebar to do some things in the drawing area.

In the constructor of my JFrame I set up the JPanels and do this...

this.requestFocus(); // get keyboard focus
drawingArea.requestFocusInWindow(); // drawingArea is a JPanel

But when I hit the space bar, the only thing that happens is an ActionEvent is fired on the default button in the OTHER JPanel!

Obviously I am setting up the keyboard focus wrong somehow, but I can't find any decent tutorials on how to set the focus for a Panel (plenty of tut's for textboxes and such but none for panels). Any ideas?