This content has been marked as final. Show 3 replies
You can use JScrollBar's method public void addAdjustmentListener(AdjustmentListener l) and add listener to listgen scrolling events1 person found this helpful
When rightmost position of the scroll is achived you increase preferred width of JScrollPane's content (+100 pixels).
Thank you, I already did that, that was the easy part. The harder part is the negative coordinate-system. You have to extend top/left, adjust the viewport position, which invokes the AdjustmentListener and then you get into an endless loop, etc. I didn't want to invent everything again from scratch, that's why thought I'd ask first.
For me the logic to avoid endless loop should be following.
When user scrolls to the leftmost position (0) you increase width (+100 pixels) and move the scrollbar to 100 position. In the AdjustmentListener you check what's the curretn value. If it's bigger than 0 just skip the event. The same with rightmost.
It should work.