title: Trying to find specific words in textArea
body: <p>So what I am trying to do here is to get the text from the JTextArea ta by using the method String code = ta.getText(); ta is located in the class TextIDE and is declared as public static JTextArea ta = new JTextArea(); </p>
  
  <p>However, after that I have retrieved the text that is inputted by the user I want to make it into a char array, so I use the method code.toCharrArray(); After that in the method compileText I use the for-statement to look for the letter 'p' and if it is found I call the method p() and I send in where the counter i was and the actual character array, so I can continue my search for the letter 'r' and I do this till the class finds the word print. Whenever it does, It should append another JTextArea which works like a console, located in a class called Listener, so I use Listener.c.jt1.append(s); whereas s is equal to whatever comes after print up until the point where it finds a semicolon ';'.</p>
  
  <p>But it doesn't work, I get no error, so I presume there is a logical error here...
  Thanks for any help!! :)</p>
  
  <pre><code>public class Compiler { 
  
      String code = TextIDE.ta.getText(); //Gets the text that was inputted by the user
  
      public Compiler(){ //Constructor
  
          if(!(code.endsWith("programEnd"))){
              Listener.c.jt2.append("Error - Code must end with line: programEnd on the last line");
          }else{
              compileText(code, 0);
          }
      }
  
      public void compileText(String code, int start){ //Starts the compiling
          char[] codeArray =  code.toCharArray();
          System.out.println(codeArray.length);
  
          for(int i = start; i &lt; codeArray.length; i++){ //Looks for character 'p'
              switch(codeArray[i]){
                  case 'p':   p(codeArray, ++i);
                              System.out.println("p");
                      break;
              }
          }
      }
  
      public void p(char[] codeArray, int start){
          for(int i = start; i &lt; codeArray.length; i++){
              switch(codeArray[i]){
                  case 'r':   r(codeArray, ++i);
                              System.out.println("r");
                      break;
              }
          }
      }
  
      public void r(char[] codeArray, int start){
          for(int i = start; i &lt; codeArray.length; i++){
              switch(codeArray[i]){
                  case 'i':   i(codeArray, ++i);
                              System.out.println("i");
                      break;
              }
          }
      }
  
      public void i(char[] codeArray, int start){
          for(int i = start; i &lt; codeArray.length; i++){
              switch(codeArray[i]){
                  case 'n': n(codeArray, ++i);
                              System.out.println("n");
                      break;
              }
          }
      }
  
      public void n(char[] codeArray, int start){
          for(int i = start; i &lt; codeArray.length; i++){
              switch(codeArray[i]){
                  case 't': t(codeArray, ++i);
                              System.out.println("t");
                      break;
              }
          }
      }
  
      public void t(char[] codeArray, int start){
              String s = "";
              for(int i = start; i &lt; codeArray.length; i++){
                  if(!(codeArray[i] == ';')){
                      s += codeArray[i];
                  }else{
                      Listener.c.jt1.append(s);
                      compileText(code, ++i);
                      break;
                  }
              }
      }
  }
  </code></pre>