private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
    StudentDao dao=new StudentDao();
        ArrayList< Student> l=new  ArrayList< Student>();
             try {
                 for(Object em:(ArrayList)dao.getAllStudents())
         l.add(( Student)em);
      
       } catch (SQLException ex) {
     //   Logger.getLogger(this.class.getName()).log(Level.SEVERE, null, ex);
        }
                
DefaultTableModel amod = new DefaultTableModel(); //setting the column name
Object[] tableColumnNames = new Object[3]; 

    

tableColumnNames[0] = "Student ID";
tableColumnNames[1] = "name";
tableColumnNames[2] = "Address";

amod.setColumnIdentifiers(tableColumnNames);

Object[] objects = new Object[3];
if (l.size() > 0)
{
    for (int i = 0; i < l.size(); i++)
    { 
       Student hashmap = l.get(i);
        objects[0]=hashmap.getId().toString();
        objects[2]=hashmap.getAddress().toString();
        objects[1]=hashmap.getName().toString();
 
        amod.addRow(objects);
    }
this.jTable1.setModel(amod);

 }
}//GEN-LAST:event_jButton1ActionPerformed