Java applet keylistener
<p>I have the following code in Game.java:</p>

<pre><code>public void start ()
{
    Thread thread = new Thread(this);
    thread.start();

    this.world = new World();
}
</code></pre>

<p>In the world class, I have the actual items of my game, a set of Walls, food and a player.</p>

<pre><code>public class World {
    private Food food;
    private HashSet&lt;Wall&gt; walls = new HashSet&lt;Wall&gt;();
    private Player player; 
    ...
}
</code></pre>

<p>The problem is as follows: I want to have my keylisteners in the player class but I can't seem to figure out how to get this...</p>

<p>I've tried by implementing the KeyListener class in Player.java and implementing the 3 functions that come with that. However, player.java does not allow me to use this.addKeyListener(this) So my keyevents are never triggered...</p>

<p>How can I make this work?</p>
