title: Can't populate a JList from a TXT File
body: <p>Here's my working code that reads a TXT File and shows it in the console:</p>
  
  <pre><code>import java.io.BufferedReader;
  import java.io.File;
  import java.io.FileReader;
  import java.io.FileNotFoundException;
  import java.io.IOException;
  import javax.swing.DefaultListModel;
  import javax.swing.JList;
  
  public class LeerArchivoDeTexto {
      public static void main(String[] args) {
          File archivo = new File("Archivo.txt");
          BufferedReader lector = null;
          DefaultListModel lista = new DefaultListModel();
          JList jList1 = new JList();
  
          try {
              lector = new BufferedReader(new FileReader(archivo));
              String texto = null;
  
              while ((texto = lector.readLine()) != null) {
                  lista.addElement(texto);
                  System.out.println(texto);
              }
              jList1.setModel(lista);
          } catch (FileNotFoundException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          } finally {
              try {
                  if (lector != null) {
                      lector.close();
                  }
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
  
      }
  }
  </code></pre>
  
  <p>The thing is that I want to load the data I have in my TXT File to a <code>JList</code>. The commented lines which envolve the <code>JList</code> aren't working. Any ideas?</p>