posted 17 years ago
I also have the same requirement and also facing the same prob. I am trying the following approach
1. Added mouse listener to JTable
2. Identified on which cell the mouse click happened.
Here's the code
public void mouseClicked(MouseEvent e)
{
if ( getSelectedColumn() != 0 )
{
//clearSelection();
setRowSelectionAllowed(false);
setCellSelectionEnabled(true);
repaint();
}
else
{
setCellSelectionEnabled(false);
setRowSelectionAllowed(true);
repaint();
}
}
However, in my table I always have a blank row as the last row. When insert few rows in table, the blank row appears always at the last. Under such situation, when I select a non blank cell, just above the blank cell, the blank cell also gets selected. I dont know how to deal with this problem. I also dont know whether I am right in my approach.
Can anyone please help me with this ?
Waiting for your reply
Thanks and Regards
Rohit.
[ January 29, 2007: Message edited by: Rohit Bhagwat ]