• Post Reply Bookmark Topic Watch Topic
  • New Topic

Performace Problem with JScrollBar on large table

 
Praveen Balaji
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have a particularly nasty problem with a ScrollBar behavior.

I have an application that shows 100 rows to start off and then check the actual row count in the background. The problem occurs when the user is dragging the scrollbar and the row count is updated.

The user starts dragging the vertical scrollbar bubble when there are only 100 rows in the table. The scrollbar is at 50% (= 50th row, say). In the meantime the rowcount in the UI is updated to 60,000,000 (say). The user is still continuing to drag without letting go of the mouse button. The viewport jumps to the 30,000,000 row. Basically, the scrollbar bubble is jumping to relative position (50%) rather than an absolute position (50th row).

Jumping to the 30,000,000th is a very expensive operation for my application and should be avoided unless the user wants to jump.

Is there anyway I can cancel the user gesture before modifying the row count? Any other way I can make sure the scrollbar bubble doesn't jump if the user doesn't let go of the mouse?

Please ask if you need any more information.

Thanks in advance for your help..
praveen.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
60 million rows, and you're concerned about the scrollbar?
How may years would it take me to scroll to the end if I'm looking for something?

Anyway, untested, perhaps you could add a mouseListener to the scrollbar, and in
mousePressed() get scrollBar's getMaximum() and table's getRowCount()
(these should be a values relative to the records in the table at that time)

a bit of arithmetic to determine the relative row, and in mouseReleased() you
have scrollRectToVisible('the row').

Might not work at all, but worth a try.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!