首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

JTable单选跟多选

2012-11-06 
JTable单选和多选??? JTable table new JTable()??? ??? // Get default selection mode??? int selMod

JTable单选和多选

??? JTable table = new JTable();
???
??? // Get default selection mode
??? int selMode = table.getSelectionModel().getSelectionMode();
??? // MULTIPLE_INTERVAL_SELECTION
???
??? // Allow only single a selection
??? table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
???
??? // Allow selection to span one contiguous set of rows,
??? // visible columns, or block of cells
??? table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
???
??? // Allow multiple selections of rows, visible columns, or cell blocks (default)
??? table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

热点排行