This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Autoscroll mechanism in JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Autoscroll mechanism in JTable" Watch "Autoscroll mechanism in JTable" New topic

Autoscroll mechanism in JTable

eric moon
Ranch Hand

Joined: Nov 26, 2000
Posts: 133
I am trying to override the behavior of the autoscroll function in JTable when extending the selection. Currently, it appears as though the autoscroller finds the cell in the table that would be under the mouse, and with each timer cycle, scrolls it to be visible. This gives nice dynamic scrolling speed, if your window is significantly smaller than the screen. However, if your window is maximized, scrolling moves very slowly. Users are complaining--our default table size is 1000 rows, and it takes forever to get through it.
I'm implementing autoscrolling for drag and drop as it's presented in Professional Java Programming. (WROX) I've modified it to be dynamic--it scrolls new rows and columns into view in increasingly larger blocks as the cursor gets closer to the edge of the table. This is done with the getScrollableUnitIncrement() method. It has the advantage of giving dynamic scrolling speed even when the window is maximized. I would like to get the same behavior out of the selection scrolling in the Table.
I had a look at BasicTableUI, and there are methods there for dealing with mouseDragging, and extending the selection. However, they refer to events generated by "the autoscroller" and I can't figure out where that code is.
Any suggestions would be welcome!
Thanks in Advance!

<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>"Those who cast the votes decide nothing. Those who count the<BR>votes decide<BR>everything." <BR> -Joseph Stalin<HR></BLOCKQUOTE>
eric moon
Ranch Hand

Joined: Nov 26, 2000
Posts: 133
Well, I didn't need to deal with the autoscroller. I just disabled the drag-to-create-selection functionality in BasicTableUI and implemented it in my drag and drop.
Have you checked out Aspose?
subject: Autoscroll mechanism in JTable
It's not a secret anymore!