bruh bruh - 11 months ago 37
Java Question

get data from a column then select whole row where the data belongs

for example this is my





now i want that the user will enter the ID, then convert that ID into which row it belongs. now i'm using
to select the row without really selecting it in the actual row. but i don't know how to get the data from a column, then convert it into a row where it belongs, so i can put in in the
. thank you for any of your help :)

Answer Source

Write a loop.

  1. You can use the getRowCount() method of the table to iterate through each row.

  2. Then you use the getValueAt(...) method to get the value of the ID in the row for the specific column.

  3. When you find a match you use the row index for the setRowSelectionInterval(...) method.