title: KeyEvents in console?
body: <p>I am attempting to build a text based platformer, but they keyboard input isnt working... Help?</p>
  
  <p>Here is the code theoretically it should move the little x whenever you press the arrow keys.</p>
  
  <pre><code>import java.awt.event.*;
  public class MAIN implements KeyListener{
      private static int renderSizeX = 100;
      private static int renderSizeY = 25;
      public static String keyInput="";
  
      public static void main(String[] args){
  
          point player = new point(50,10,'X');
          while(true==true){
              m.sleep(160);
              if(keyInput=="38")//up key
                  player.moveY(1);
              if(keyInput=="40")//down key
                  player.moveY(-1);
              if(keyInput=="37")//&lt; key
                  player.moveX(-1);
              if(keyInput=="30")//&gt; key
                  player.moveX(1);
              m2.render(new point[]{player});
          }
      }
  
  public static int windowX(){ return renderSizeX;}
  
  public static int windowY(){ return renderSizeY;}
  //KEYBOARD INPUT!
       public void keyTyped(KeyEvent e){
            keyInput = e.getKeyCode()+"";
       }
  
       public void keyPressed(KeyEvent e){
       }
  
       public void keyReleased(KeyEvent e){
            keyInput = "";
       }
  }
  </code></pre>
  
  <p>I dont think there is anything wrong with my rendering class and point class but i will show them as well.</p>
  
  <pre><code>public class point{
      int x, y;
      char letter;
      public point(int inX, int inY, char letterRepresent)
      {
          x = inX;
          y = inY;
          letter=letterRepresent;
      }
  
      public char getChar(){return letter;}
      public int getX(){return x;}
      public int getY(){return y;}
      public void moveX(int ammount){x+=ammount;}
      public void setX(int location){x=location;}
      public void moveY(int ammount){y+=ammount;}
      public void setY(int location){y=location;} 
  }
  
   public class m{
  
       //sleep method
      public static void sleep(int milli){
           try {
              Thread.sleep(milli);                 //1000 milliseconds is one second.
           } catch(InterruptedException ex) {
               Thread.currentThread().interrupt();
           }
  
  
  public class m2
  
  {
          public static void render(point[] input){
              System.out.print("\f");//Clears screen
              for(int y = 0; y &lt; MAIN.windowY(); y++){
              for(int x = 0; x &lt; MAIN.windowX(); x++){
                  char found = ' ';
  
                  for(int i = 0; i &lt; input.length;i++){
                      if( input[i].getY() == y &amp;&amp; input[i].getX() == x ){//checks to see if list of points contains a point at current x and y position
                          found = input[i].getChar();
                      }
                  }
                  System.out.print(found);//prints char if found else prints space
              }
              System.out.print("\n");
          }
  
      }
  
  }
  </code></pre>