I want to pass the focus to 1st row of JTable. I can't use editCellAt(row,column) method because I don't want to allow user to change content of table. changeSelection(row,column,false, false) method also does not work properly.
Please suggest me some way to transfer focus to first row.
I have textfield and table. Initially my control is at textfield. If I press ENTER,control should go at first row of table. I have provided the code below. Please help me out.
private void txtRawMaterial(java.awt.event.KeyEvent evt) //txtRawMaterial is textfield
{
if (evt.getKeyCode()==KeyEvent.VK_ENTER)
{
if(table.getRowCount()>0) //table is jTable
{
table.requestFocus();
}
}
}