Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- table.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
- public void valueChanged(ListSelectionEvent event) {
- int selectedRowIndex = tutabla.getSelectedRow();
- int columnCount = tutabla.getColumnCount();
- String[] selectedRowData = new String[columnCount];
- // iteras la fila y obtienes los valores de las celdas
- for(int i=0; i<columnCount; i++) {
- selectedRowDate[i] = (String) tutabla.getValueAt(selectedRowIndex, i);
- }
- // asignas los valores a tus textfields
- txtNombre.setText(selectedRowData[0]);
- txtApellido.setText(selectedRowData[1]);
- ...
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement