首先要用Jtable里mouseClicked事件,首先定义个变量来获取所点击的行数单行用table.getSelectRow() public void table_mouseClicked(MouseEvent mouseEvent){ int i = table.getSelectedRow(); txtName.setText((String)model.getValueAt(i, 0)); txtPass.setText((String)model.getValueAt(i, 1)); }