I have a Jtable that is populated with a linkedlist through an AbstractTableModel.
What I want to do is when I click (left-mouse click) on a row in the JTable, the linke
Here's how I did it:
table.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
public void valueChanged(ListSelectionEvent event) {
// do some actions here, for example
// print first column value from selected row
System.out.println(table.getValueAt(table.getSelectedRow(), 0).toString());
}
});
This code reacts on mouse click and item selection from keyboard.