title: Read from file and display in GUI java
body: <p>I need to read the file in the main than add the red lines (from the file) to an array in the class that stores array objects and display in GUI class. My problem is that nothing goes to the GUI. The <code>getTeamName</code> from <code>Team</code> returns <code>null</code>. </p>
  
  <p>I read the file in </p>
  
  <pre><code>                fr = new FileReader("TeamsIn.txt"); 
                  Scanner in = new Scanner(fr);
                  while (in.hasNextLine()){
                  String line = in.nextLine();
  
                  team = new Team(line);
                  team = teamIn.addTeam(team);
  </code></pre>
  
  <p>than I add lines to the Team [] array in MatchManager</p>
  
  <pre><code>    public  Team addTeam( Team teamName)
      {
           for(int i = 0; i &lt; MAX_TEAMS; i++)
  
                   teams[i] = teamName;
  
           return teamName;
  
  
      }
  </code></pre>
  
  <p>And i want to display in the GUI</p>
  
  <pre><code>         Team t = new Team(teamName);
  
  
       display = new JTextArea(ROWS, COLUMNS);
       display.setEditable(false);
       display.setText(t.getTeamName());
       JScrollPane scrollPane = new JScrollPane(display);
       return scrollPane;
  
  
  
  
     public class Team {
  
  
      public Team(String teamName){
          this.teamName = teamName;
          //System.err.println(teamName);
      }
  
  
  
  
      public String getTeamName(){
          return teamName;
      }
      public String setTeamName(String tName){
          return teamName;
      }
  </code></pre>
  
  <p>But the <code>display.setText(t.getTeamName());</code> doesnt return anything.</p>