title: Display elements in an arraylist in a JTextArea
body: <p>I'm creating a word game in which the player must make as many words as possible using the letters in the word given. (Example: The word given is "elephant" so possible answers would be pant and help). I want to display the right answers into a textbox. Right now, the only thing that displays are the blank text areas. </p>
  
  <p>Here is the code that puts the words into their respective arraylists: </p>
  
  <pre><code>public void checkAnswers() { 
      ArrayList&lt;String&gt; validAnswers = new ArrayList&lt;String&gt;();
      ArrayList&lt;String&gt; wrongAnswers = new ArrayList&lt;String&gt;();
      ArrayList&lt;String&gt; notFound = new ArrayList&lt;String&gt;();
      List&lt;String&gt; compare = new ArrayList&lt;String&gt;();
  
      if (r == 0){
      compare = arr1Sub;
      }
      else if (r == 1){
              compare = arr2Sub;
      }
      else if(r == 2){
              compare = arr3Sub;
      }
      else{
              compare.add("error");
              System.out.println(compare);
      }
      for (int i = 0; i &lt; inputList.size(); i++){
          if (compare.contains(inputList.get(i))){ 
                  validAnswers.add(inputList.get(i));
          }
          else if (!compare.contains(inputList.get(i))){
                  wrongAnswers.add(inputList.get(i));
          }
          else{
                  notFound.add(compare.get(i)); 
          }
  
      for(String s : validAnswers){
          txtvalidWords.append(s.toString()); 
      }  
  </code></pre>
  
  <p>Here is the code for the GUI:</p>
  
  <pre><code>public void CheckAnswersGUI(){
      JPanel answersPanel = new JPanel(); 
      JPanel wrongPanel = new JPanel(); 
      JPanel possiblePanel = new JPanel(); 
      container = new JPanel(); 
  
      lblvalid = new JLabel("Valid Answers"); 
      txtvalidWords = new JTextArea("",30,30); 
      lblwrong = new JLabel("Wrong Answers"); 
      txtwrongWords = new JTextArea("",30,30); 
      lblpossible = new JLabel("Answers Not Found"); 
      txtpossibleWords = new JTextArea("",30,30); 
  
      btnPlayAgain = new JButton("Play Again"); 
      btnPlayAgain.addActionListener(this);  
  
      FlowLayout checkLayout = new FlowLayout(); 
      answersPanel.setLayout(checkLayout); 
      wrongPanel.setLayout(checkLayout); 
      possiblePanel.setLayout(checkLayout);
  
      container.setLayout(new BoxLayout(container,BoxLayout.X_AXIS)); 
      container.add(answersPanel); 
      container.add(wrongPanel); 
      container.add(possiblePanel);  
      container.add(btnPlayAgain);   
  
      inputList = new ArrayList&lt;String&gt;();
      String text = inputWords.getText(); 
      String[] words = text.split("\\s"); 
  
      for (String word : words){
          inputList.add(word); 
      }
  
      answersPanel.add(lblvalid);  
      answersPanel.add(txtvalidWords); 
      wrongPanel.add(lblwrong); 
      wrongPanel.add(txtwrongWords); 
      possiblePanel.add(lblpossible); 
      possiblePanel.add(txtpossibleWords); 
      getContentPane().add(container); 
  
      setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
      setLocationRelativeTo (null);
      setSize (700,500);
      setTitle ("Check Your Answers");
      setVisible(true);
  }   
  
      }
  </code></pre>