Cannot find symbol error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Empyrean
    New Member
    • Mar 2007
    • 3

    Cannot find symbol error

    Okay, I'm getting an error in the line:

    Code:
    public class Graphics extends JFrame implements KeyListener
    {
    I get the error Cannot Find Symbol

    The code works fine when I take out the implements KeyListener, but when I put it in it won't compile.
  • horace1
    Recognized Expert Top Contributor
    • Nov 2006
    • 1510

    #2
    Originally posted by Empyrean
    Okay, I'm getting an error in the line:

    Code:
    public class Graphics extends JFrame implements KeyListener
    {
    I get the error Cannot Find Symbol

    The code works fine when I take out the implements KeyListener, but when I put it in it won't compile.
    if you implement KeyListener your code must contain the methods keyPressed, keyReleased and keyTyped

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      It can help too to do this:

      Code:
      import java.awt.KeyListener;
      kind regards,

      Jos

      Comment

      Working...