salut
j'utilise un jtable avec comme modele RowTableModel
je voudrait en cliquant sur une ligne, les donnés du jtable s'affichent dans des zones textes
comment faire
Version imprimable
salut
j'utilise un jtable avec comme modele RowTableModel
je voudrait en cliquant sur une ligne, les donnés du jtable s'affichent dans des zones textes
comment faire
Essaie ceci:
Code:table.getSelectionModel().addListSelectionListener(new RowListener());
Voir aussi: http://java.sun.com/docs/books/tutor...html#selectionCode:
1
2
3
4
5
6
7
8
9
10 class RowListener implements ListSelectionListener { public void valueChanged(final ListSelectionEvent event) { if (event.getValueIsAdjusting()) { return; } int selectedRow = table.getSelectedRow(); RowTableModel model = (RowTableModel) table.getModel(); System.out.println(model.getValueAt(selectedRow, 0)); } }