I would like to move the selected row to be the first row in a JTable. I don't want to copy the data into the first row of the model. I have a class which has as parameters a jtextfield and table. if I type string in the jtextfield, the class tries to match the string within a column containing string values. Currently it selects the matching row and make it visible. But, I would like to make the matching row visible and be the first visible row in the table.
Thanks for the response but this does not solve my probem. I have the code working to match the appropriate row in the table to text entered in textfield. Currently it matches and scrolls to the match row. But, I would like it to scroll to the top most visible row in the table. I want the founded row to be the first row in viewport,it should be highlighted and be the first visible row in table. There could be other rows above the highlighted row. The user could scroll up or down to show the rows below and above the selected row.
In the demo program, the program opens showing rows 0 to 4 if I enter 25 into the textfield and click the button, row 25 (0-based) is the top row showing in the viewport (the rows showing are 25 to 29). if I then enter 3, row 3 is the top row (showing 3 to 7) if I then enter 47, row 45 is the top row (the scrollbar only goes to 49, so showing is 45 to 49)
That's how your description reads to me, so I'm not really sure what you are trying to achieve.
Just working with the 25, what rows do you want to see when 25 is entered?