you must implement the behaviour by yourself, by using ResultSet statement methods, in this case, next() and previous() methods
the methods retruns a boolean values that indicates whether there is a next or previous record, you can use it to enable and disable your buttons
look this link for how to use a JDBC statement
http://docs.oracle.com/javase/tutorial/jdbc/basics/processingsqlstatements.html
assuming that nextBtn and PreviousBtn are your and your Bouttons and res your ResultSet, we need two variable (hasNext and hasPrevious) to save the state of our buttons, you may refer to the snippet below that you must adapt to your case, it will not work directly .
private boolean hasNext = false;
private boolean hasPrevious = false;
public void updateBtnState() {
nextBtn.setEnabled(hasNext);
previousBtn.setEnabled(hasPrevious);
}
previousBtn = new JButton(" Previous <<");
previousBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
hasPrevious = res.previous();
if (hasPrevious ) hasNext = true;
// do something
updateBtnState();
}
});
nextBtn = new JButton(" Next >>");
nextBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
hasNext = res.next();
if (hasNext ) hasPrevious = true;
// do something
updateBtnState();
}
});