table=new JTable(cells,columnNames);
table.addMouseListener(new java.awt.event.MouseAdapter()
{
public void mouseClicked(java.awt.event.MouseEvent e)
{
System.out.println("mouseClicked()"); // TODO Auto-generated
// Event stub
// mouseClicked()
System.out.println("row numbers is :"+table.getRowCount());//获取表格的总行数
//获取鼠标点击的行的位置(及行数)
Point mousepoint;
mousepoint =e.getPoint();
System.out.println(table.rowAtPoint(mousepoint)+1);
}
});