Select multiple JTable rows

I am currently using JTable to display content in a database. I want to provide a tool for the user so that he can select the number of rows he wants using the shift + key, and then delete these entries using the option provided for deletion. Give a small example.

+7
java swing jtable
source share
1 answer

You need to allow several options:

table.setRowSelectionAllowed(true); table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); 

Then you need to write the appropriate listener of choice. It's a little trickier, try finding in Google related solutions. You can see an example of a listener of choice .

+21
source share

All Articles