Selection mode in JTable?

不打扰是莪最后的温柔 提交于 2019-12-10 10:56:02

问题


I couldn't understand the difference between multiple_selection_interval and single_interval_selection in JTable.

table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);

next, is

table.setSelectionMode(ListSelectionModel.MULTIPLE_SELECTION_INTERVAL);

What's the difference these?


回答1:


With ListSelectionModel.SINGLE_SELECTION you can just select one row. With ListSelectionModel.SINGLE_INTERVAL_SELECTION you can select more than one row, which are in one block. (e.g. you can select row 1 - 5, but not row 1-3 and row 4-6, therefor you need ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)



来源:https://stackoverflow.com/questions/2407136/selection-mode-in-jtable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!