How to get multiple select values โ€‹โ€‹from JTable

Can someone provide a sample code or at least a method that I can use to get the string values โ€‹โ€‹of multiple options in JTable? I searched on the Internet, but I only found examples of how to get values โ€‹โ€‹from a single selection. Based on this, I tried to implement the code myself using loops, but it exploded on my face. Any help would be appreciated.

+4
source share
1 answer

JTable has a method for this:

int[] selection = table.getSelectedRows(); 

Of course, this method returns the indices of the selected rows. You can use these indexes to get the desired values โ€‹โ€‹from the table model.

+8
source

Source: https://habr.com/ru/post/1437850/


All Articles