Forums Register Login

Disabling Mouse Drag or highlighting when mouse dragged on JTable

+Pie Number of slices to send: Send
How would you disable mouse drag or the selection of multiple rows when the mouse is dragged? I can select the whole list with a mouse drag and I don't really want to be able to do this. I have tried several things and nothing has really worked.
+Pie Number of slices to send: Send
Selection is explained in the JTable tutorial.
+Pie Number of slices to send: Send
 

Hauke Ingmar Schmidt wrote:Selection is explained in the JTable tutorial.



I like single selection but is their anyway to add ctrl+click to this selection?
+Pie Number of slices to send: Send
 

Charles Sexton wrote:I like single selection but is their anyway to add ctrl+click to this selection?



Well, yeah, if you follow Hauke Ingmar's link you'll see an example right there. See the "Selection Mode" radio buttons? Multiple Interval Selection is the version which uses Ctrl-click.
+Pie Number of slices to send: Send
 

Charles Sexton wrote:How would you disable mouse drag or the selection of multiple rows when the mouse is dragged? I can select the whole list with a mouse drag and I don't really want to be able to do this.



As for your original question: Why is it a problem that you can select rows that way? Surely you aren't accidentally dragging the mouse over the table and selecting rows you didn't mean to select?

I ask because it's often difficult to disable part of the normal functioning of a component. So if there isn't a serious need to answer this question, I would just leave it to work the way it works now.
+Pie Number of slices to send: Send
 

Paul Clapham wrote:

Charles Sexton wrote:How would you disable mouse drag or the selection of multiple rows when the mouse is dragged? I can select the whole list with a mouse drag and I don't really want to be able to do this.



As for your original question: Why is it a problem that you can select rows that way? Surely you aren't accidentally dragging the mouse over the table and selecting rows you didn't mean to select?

I ask because it's often difficult to disable part of the normal functioning of a component. So if there isn't a serious need to answer this question, I would just leave it to work the way it works now.



ok thank you
+Pie Number of slices to send: Send
 

Paul Clapham wrote:

Charles Sexton wrote:How would you disable mouse drag or the selection of multiple rows when the mouse is dragged? I can select the whole list with a mouse drag and I don't really want to be able to do this.



As for your original question: Why is it a problem that you can select rows that way? Surely you aren't accidentally dragging the mouse over the table and selecting rows you didn't mean to select?

I ask because it's often difficult to disable part of the normal functioning of a component. So if there isn't a serious need to answer this question, I would just leave it to work the way it works now.



Actually, I have a need to do this, too. In my case, I always want the drag gesture to be processed as a part of a drag-and-drop sequence. I do want the user to have the ability to select multiple rows through control- or shift-click, but mouse drag is the prelude to drag-and-drop. As it is, sometimes the drag gesture is interpreted as a multi-row select prior to handling the drag gesture event. It seems you have a choice of either single-select, or ambiguous drag-and-drop processing.
1
+Pie Number of slices to send: Send
Alert teammate found solution here: https://community.oracle.com/thread/1351319

The only thing that kept the leeches off of me was this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 3036 times.
Similar Threads
JTable
JTable cell is selected but i want the entire row to be selected
JTable
Row highlight in a JTable
JTable using CTRL + Click for multiple row selection
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 05:24:01.