title: Creating a Vector<Vector<String>> to import .txt file into a JTable
body: <p>I'm having problems coverting from the 1-d vector "v" to the 2-d vector "myVector". If you could lend a hand and help me figure this out it would be greatly appreciated. Open to any suggestions.</p>
  
  <pre><code>import java.io.BufferedReader;
  import java.io.FileReader;
  import java.util.Vector;
  import javax.swing.JFrame;
  import javax.swing.JPanel;
  import javax.swing.JScrollPane;
  import javax.swing.JTable;
  import javax.swing.table.DefaultTableModel;
  
  public class InsertDataFinal {
  
  public static void main(String args[]) {
      Vector&lt;String&gt; v = new Vector&lt;String&gt;(3);
  
      Vector&lt;Vector&lt;String&gt;&gt; myVector = new Vector&lt;Vector&lt;String&gt;&gt;();
      int i = 0;
      int j = 0;
      try {
  
          FileReader fReader = new FileReader("Password.txt");
          BufferedReader inFile = new BufferedReader(fReader);
          String input;
          String[] temp;
          while ((input = inFile.readLine()) != null) {
  
              temp = input.split(" ");
  
              for (i = 0; i &lt; temp.length; i++) {
  
                  v.add(temp[i]);
              }
  
              myVector.add(j, v);
              j++;
          }
  
      } catch (Exception e) {
          System.out.println("ERROR");
      }
  
      Vector&lt;String&gt; columnNames = new Vector&lt;String&gt;(3);
      columnNames.addElement("Website");
      columnNames.addElement("Username");
      columnNames.addElement("Password");
      DefaultTableModel model = new DefaultTableModel(myVector, columnNames);
      JTable table = new JTable();
      table.setModel(model);
      JScrollPane scrollpane = new JScrollPane(table);
      JPanel panel = new JPanel();
      panel.add(scrollpane);
      JFrame frame = new JFrame();
      frame.add(panel, "Center");
      frame.pack();
      frame.setVisible(true);
      }
  }
  </code></pre>