Double Buffered Applet conflict.

E

Ed Dana

Hi All,

I have a program I'm working on that draws Sonic the Hedgehog and makes
him run around in circles on the JApplet. It implements KeyListener and
Runnable.

All images are being drawn on a canvas, and work fine. However, whenever
I add the canvas to the the JApplet using "this.getContentPane( canvas
)" the KeyListeners stop working.

Java! It is making me cRAzY!!! ;)

Any clues greatly appreciated.

Ed.
 
E

Ed Dana

Oops! I'm using this statement to add the canvas:
"this.getContentPane().add( canvas )"

Stupid Keyboard! ;)

Ed.
 
E

Ed Dana

Posting the code isn't necessary. The problem is very simple. I have an
Applet. I add key listeners, they respond when I test them.

Those very same KeyListeners suddenly stop working after adding a Canvas.

I think this is a focus/scope issue. If I add listeners to the Canvas,
the Canvas listeners get called. I remove the canvas, the Applet
listeners get called.

So, how do I keep the canvas while still getting the applet key
listeners to respond?

Ed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top