Double Buffered Applet conflict.

Discussion in 'Java' started by Ed Dana, May 2, 2005.

  1. Ed Dana

    Ed Dana Guest

    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.
    Ed Dana, May 2, 2005
    #1
    1. Advertising

  2. Ed Dana

    Ed Dana Guest

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

    Stupid Keyboard! ;)

    Ed.
    Ed Dana, May 2, 2005
    #2
    1. Advertising

  3. code
    Ishmael Rufus, May 2, 2005
    #3
  4. Ed Dana

    Ed Dana Guest

    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.
    Ed Dana, May 2, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sydex
    Replies:
    12
    Views:
    6,453
    Victor Bazarov
    Feb 17, 2005
  2. Replies:
    9
    Views:
    664
    Michael Wojcik
    Aug 23, 2005
  3. Clay Hobbs
    Replies:
    0
    Views:
    217
    Clay Hobbs
    Oct 5, 2008
  4. Clay Hobbs
    Replies:
    1
    Views:
    347
  5. charles cashion

    css conflict (or html conflict)

    charles cashion, Feb 18, 2009, in forum: HTML
    Replies:
    2
    Views:
    777
    charles cashion
    Feb 18, 2009
Loading...

Share This Page