When I left click a row in the Jtable the row is set to focus... but when I right click a row in the Jtable.. that particular row doesn't seeks any focus.
How can I make it possible? please suggest:(
Printable View
When I left click a row in the Jtable the row is set to focus... but when I right click a row in the Jtable.. that particular row doesn't seeks any focus.
How can I make it possible? please suggest:(
Add your own listener to do the selection. Something like:
Code:table.addMouseListener( new MouseAdapter()
{
public void mouseReleased(MouseEvent e)
{
if (e.isPopupTrigger())
{
JTable source = (JTable)e.getSource();
int row = source.rowAtPoint( e.getPoint() );
int column = source.columnAtPoint( e.getPoint() );
if (! source.isRowSelected(row))
source.changeSelection(row, column, false, false);
}
}
});
It worked Thanks..