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

选中行
table.getSelectionModel().setSelectionInterval(startRowIndex, endRowIndex);

监听选择事件
table.getSelectionModel().addListSelectionListener(new ListSelectionListener(){

			@Override
			public void valueChanged(ListSelectionEvent e)
			{
				int row = table.getSelectedRow();
				if(row != -1)
				{
					XXXModel model = (XXXModel)tbEmpList.getModel();
				}
			}
		});

你可能感兴趣的:(java)