Forums Register Login

JTable using CTRL + Click for multiple row selection

+Pie Number of slices to send: Send
I know how to do single selection, but I would like to do multiple row selection only by using CTRL + click without the option of dragging the mouse to select rows. So the user would have to hit ctrl + click each time to highlight additional rows. What would I need to do in order to do this?
1
+Pie Number of slices to send: Send
By default that's already enabled.

There are two important settings for selection:
- the selection mode (single selection, single interval, multiple intervals). You can change this with method setSelectionMode.
- whether or not separate columns can be selected, or only rows. You can change this with method setColumnSelectionAllowed

The default is multiple intervals and only row selection.
+Pie Number of slices to send: Send
 

Rob Spoor wrote:By default that's already enabled.

There are two important settings for selection:
- the selection mode (single selection, single interval, multiple intervals). You can change this with method setSelectionMode.
- whether or not separate columns can be selected, or only rows. You can change this with method setColumnSelectionAllowed

The default is multiple intervals and only row selection.



Would I have to do a mouse event listener in order to disable the mouse drag? Whenever you drag in either Multiple_Intervale or Single_Interval it highlights more than one row. Would mouse event listener be the best way to remove this?
Whip out those weird instruments of science and probe away! I think it's a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2326 times.
Similar Threads
select multiple cells in table
Mulitple row move, not copy, in JTable using DnD
Multiple selection in JTable
Enabling Row Selection in a JTable
keyboard short cuts in java...
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 00:13:25.