JTable中的选择模式? [英] Selection mode in JTable?

查看:213
本文介绍了JTable中的选择模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法理解 JTable中 multiple_selection_interval single_interval_selection 之间的区别

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

table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);

下一步是

table.setSelectionMode(ListSelectionModel.MULTIPLE_SELECTION_INTERVAL);

这些有什么区别?

推荐答案

使用 ListSelectionModel.SINGLE_SELECTION ,您只需选择一行即可。
使用 ListSelectionModel.SINGLE_INTERVAL_SELECTION ,您可以选择多个行,这些行位于一个块中。 (例如,您可以选择第1行,但不能选择第1-3行和第4-6行,因此您需要 ListSelectionModel.MULTIPLE_INTERVAL_SELECTION

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)

这篇关于JTable中的选择模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆