This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Performace Problem with JScrollBar on large table  RSS feed

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..
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.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!