Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need to scroll JScrollPane on mousedrag - Urgent

 
Raghvendra Sharma
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
What i am struggling with is something strange to me.
I have two panels put vertically. (say leftPanel and rightPanel). These panels themselves contain no. of horizontal elements (h1, h2, h3 etc.) and the no of items in left and right panels need not be same.
The two panels(left and right) in turn are embedded into another panel which is enclosed into a JScrollPane.
Requirement says that the user should be able to drag items from left panel and drop them on the right panel's item.
The problem that i am facing is when the user tries to drag item 1 (say) from left and wishes to drop it onto some element of right panel which is not visible (due to scrollbar), he's not able to do that. Since, the jscrollpane's scrollbar doesn't scroll depending on the mouse drag position, i am not able to do that.
What i am currently thinking is capturing the drag over method/event of drag source listener and then check whether the dragged mouse location is outside the current viewport. If that is the case, i would try to scroll the scrollbar forcibly in the reverse direction.
But somehow i don't feel this would work out. Pleae suggest some ideas.
any type of ideas links/hints are welcome.
plz treat it as urgent
Regards
raghav..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic