开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜