The code for the Previous button is similar to the Next button.
But instead of using rs.Next, you use rs.Previous.
Return to the Design window and double click your Previous button to
create a code stub.
Instead of typing out all that code again, simply copy and paste the code from
your Next button. Then change the rs.Next, in the IF statement to rs.Previous.
Change the rs.Previous in the ELSE part to rs.Next. You can also change your
error message text from “End of File” to “Start of File”.
Your code should look like this:
Run your programme again. You should be able to move backward and forward through
the database by clicking your two buttons.
Kaynak : https://www.homeandlearn.co.uk/java/move_back_through_a_java_database.html ‘sitesinden alıntı