Java新手,我在一个应用程序中有JTable。我可以在创建表后添加/删除行来添加标题。我坚持实现行单击事件。怎么做?
....
DefaultTableModel model = new DefaultTableModel();
JTable table = new JTable(model);
model.addColumn("Col1");
model.addColumn("Col2");
//model.addTableModelListener(table); // what should be added here? or what else?
String[] rowData={"Preety","Shivani"};
model.addRow(rowData);
.... // there are more rows