getSelectedColumn和getSelectedRow返回的是第几列和第几行,如果没有获得改值则返回-1
(Returns the index of the first selected column, -1 if no column is selected.)
(Returns the index of the first selected row, -1 if no row is selected.)
(Returns the index of the first selected column, -1 if no column is selected.)
(Returns the index of the first selected row, -1 if no row is selected.)
//你自己创建一个jtable的实例
jt.addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
{
if(e.getClickCount()==1)
{ int rowCount=jt.getSelectedRow();
int clumnCount=jt.getSelectedClumn();
}
}
});
这是鼠标监听获得单击CELL的行值和列值!都是从0开始的!