i want to get next record of the table whenever clicking on button in swing form
Hai,
I want to create a JFrame with some TextFields and Buttons .I want to get next record in the table whenever i click开发者_JAVA技巧s on a "next button" and also a "previousbutton",clicks on it get the prprevous value from the table.
Here's some pseudo-code to get you started.
- Set the table's selection model mode to support single row selection.
- When the user clicks next get the currently selected row. If there is no currently selected row then select record 0. Otherwise select record at selected row + 1.
- Do the same for when they click previous (apart from accessing selected row - 1).
Tip: When retrieving the record from the underlying TableModel be sure to convert the selected row view index to the equivalent model index.
精彩评论