I have a master/detail form with a JTable on top, and all the JTextFields corresponding below in the JPanel. I'm trying to make a search in the JTable, so that when the correct row gets picked, all the JTextFields can be filled with the column values. I don't know how can I call the rows programmatically to do so. How would it be done?
This is the code I'm using to do the search:
int rows = (masterTable.getModel()).getRowCount();
final int colCedula = 1; //columna de la CEDULA
final int colRuc = 11; //columna de RUC
String value = null ;
for(int i=0; i
value = (String) (masterTable.getModel()).getValueAt(i, colCedula);
if (value.equals(this.txt_BuscaCliente.getText())) {
//CODE FOR FILLING JTEXTFIELDS
}
If the search finds the column value and stops the loop, could I just write in the //CODE section masterTable.getSelectedRow() and then fill all the JTextFields with its column values???
Also, how is it done to have the row selected highlighted, programatically? Let's say, after my search finds the column value, to have that row highlighted in the JTable