aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Need to scroll JScrollPane on mousedrag - Urgent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Need to scroll JScrollPane on mousedrag - Urgent" Watch "Need to scroll JScrollPane on mousedrag - Urgent" New topic
Author

Need to scroll JScrollPane on mousedrag - Urgent

Raghvendra Sharma
Ranch Hand

Joined: Oct 09, 2000
Posts: 82
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..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need to scroll JScrollPane on mousedrag - Urgent