I have a class called Student with some instance fields(like Name,age,sex ), and I want to add object of Student type to JTable.
In table I want to display Student class fields. I have extended a class StudentModel from AbstractTableModel.My StudentModel
contains a Vector to keep student data.
But how do I add student object to StudentModel.and display in JTable
apparently your problem is not related to Swing but to learning the Java language.
If your aim is to learn Java, you should tackle this compile error. For that I suggest you turn to a colleague or a fellow student... or continue here, but you need to give more code than just the bit that doesn't compile.
If your aim is to make the darn program display students in a JTable, you can have a look at BeanTableModel (http://tips4java.wordpress.com/2008/11/27/bean-table-model/).