读书人

jtable选中拇指定的行和选中事件监听

发布时间: 2012-11-08 08:48:11 作者: rapoo

jtable选中指定的行和选中事件监听
选中行
table.getSelectionModel().setSelectionInterval(startRowIndex, endRowIndex);

监听选择事件

table.getSelectionModel().addListSelectionListener(new ListSelectionListener(){@Overridepublic void valueChanged(ListSelectionEvent e){int row = table.getSelectedRow();if(row != -1){XXXModel model = (XXXModel)tbEmpList.getModel();}}});

读书人网 >编程

热点推荐