• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Disabling Mouse Drag or highlighting when mouse dragged on JTable

 
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Rancher
Posts: 436
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Selection is explained in the JTable tutorial.
 
Charles Sexton
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Paul Clapham
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Charles Sexton
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Bridget Kennedy
Ranch Hand
Posts: 86
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alert teammate found solution here: https://community.oracle.com/thread/1351319

 
The human mind is a dangerous plaything. This tiny ad is pretty safe:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic