2

So I have a class that uses a KeyListner, when various events occur various boolean become true.

Now this class has a constructor, an instance of this class is called within an JApplet. Now everything works except the Keylistner.

When the applet is running, the KeyListner does not respond to any of my actions. However I know that its not a fault in my code because when I put a main method within the class it works fine.

So in summary, How can I use a KeyListner...where all its methods are within another class. and this class is constructed within an applet.

recurf
  • 237
  • 4
  • 16
  • 1
    show some code? Where did you *register* the keylistener? – Jan Dec 04 '15 at 11:58
  • I dont have the code at hand, basically its a Java game im trying to make in an applet. All the actual logic and grid is located in 1 class, and ofcourse the applet is created in another class. the difficulty for me is changing the variables located within the logic class t from within the applet its self. hope you understand that – recurf Dec 04 '15 at 13:36

1 Answers1

0

I was trying to call the variable from the class within the "init", this is why I could not successfully reference the variable. By simply creating the instance of the class from outside the "init" everything worked as expected.

recurf
  • 237
  • 4
  • 16