title: keylistener and runnable not working
body: <p>can you see the problem. the thread runs fine but the brick does not want to respond to the key listener. I try to test if the <code>keylistener</code> was at last getting an event but it does not even do the <code>system.out.println</code></p>
  
  <pre><code>import java.awt.*;//imports
  import java.util.*;
  import java.applet.*;
  import java.awt.event.KeyListener;
  import java.awt.event.KeyEvent;
  
  public class Start extends Applet implements Runnable, KeyListener// where i put the keylistener in
  {
  
      DrawBackground dbg = new DrawBackground();
      Brick brick = new Brick();
      Thread gameLoop;
  
      public void init() {
          addKeyListener(this);// i add the key listener
      }
  
      public void start() {
          Thread gameLoop = new Thread(this);
          gameLoop.start();
      }
  
      public void run() {
          while (true) {
  
              brick.update(1);
              repaint();
              try {
                  Thread.sleep(17);
              }
              catch (InterruptedException e) {
              }
  
          }
      }
  
      public void stop() {
  
      }
  
      public void paint(Graphics g)// with out any paint it works if im changing
                                   // somthing like a lable
      {
          dbg.paint(g, this);
          brick.paint(g, this);
      }
  
      public void keyPressed(KeyEvent e)// test to see if it works
      {
          System.out.println("why");
          if (e.getKeyCode() == 37) {
              brick.left();
          }
      }
  
      public void keyTyped(KeyEvent e) {
      }
  
      public void keyReleased(KeyEvent e) {
  
      }
  }
  </code></pre>
  
  <p>this is the Brick class the thing i'm trying to move</p>
  
  <pre><code>import java.awt.*;
  import java.util.*;
  import java.applet.*;
  
  public class Brick {
  
      public int dy = 40;
      public int yStart = -20;
      public int time = 0;
      public int dx = 0;
      public int xStart = 0;
      public int start = 1;
  
      public void paint(Graphics g, Start sp) {
          Dimension screenSize = sp.getSize();
          int sheight = screenSize.height;
          int swidth = screenSize.width;
          if (start == 1) {
              xStart = swidth - (int) (swidth / 2.5);
              start = 0;
          }
          int bWidth = swidth / 15;
          int bHeight = swidth / 15;
          int time = 0;
          g.setColor(Color.red);
          g.fillRect(xStart, yStart, bWidth, bHeight);
      }
  
      public void update(int x) {
          if (time == 60) {
              time = 0;
              yStart += dy;
          }
          else {
              time += x;
          }
      }
  
      public void left() {
          xStart -= dx;
      }
  }
  </code></pre>