Code example for Vector

Methods: addElement

0
 
       public static void main(String[]_) throws Exception {
              
              Vector<Vector<String>> tableData = readCSVFile("data.csv");
 
              Vector<String> header = new Vector<String>();
 
                             header.addElement("Col 1");
                             header.addElement("Col 2");
                             header.addElement("Col 3");
                             header.addElement("Col 4");
 
 
         //   Create the 'JTable'. The following constructor makes 
         //   every cell editable. If this is not desired, a 
         //  'TableModel' must be implemented. 
              JTable      table      = new JTable(tableData, header);
 
              JScrollPane scrollPane = new JScrollPane(table);
 
              JFrame      frame      = new JFrame("Frame containing a JPanel");