JTable, detecting selection changes // ListSelectionListener /*Selection Changed Event*/ 2


When working with tables, it may be useful to detect selection changes. If for example, you need to sum the values of a specified column in a selection range, this method will be most essential.

If you explore the available methods to add listeners to a JTable, you will notice there’s no such thing as a selectionListener. This is because the JTable has its own selection model, where you can add the listener.

The following code illustrates the way to go to add a selection listener:


Leave a comment

Your email address will not be published. Required fields are marked *

2 thoughts on “JTable, detecting selection changes // ListSelectionListener /*Selection Changed Event*/