aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes erratic scrolling behavior with JTable with variable height rows Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "erratic scrolling behavior with JTable with variable height rows" Watch "erratic scrolling behavior with JTable with variable height rows" New topic
Author

erratic scrolling behavior with JTable with variable height rows

Joe Tal
Greenhorn

Joined: Mar 06, 2009
Posts: 2
I downloaded the source from this book: http://java.sun.com/developer/Books/gui/swing2/
for the variable row height JTable found at the end of Chapter 18. I modified it to handle 351 rows of varying size data. It is appended at the end of this message as a single file named ExpenseReport.java. I also added a refresh button whose actionPerformed() refreshes the JTable by a fireTableChanged. This button is the third button over

Straightforward stuff, right? Well, compile this file and run it. Scroll to (say) 75% with the scrollbar. Click the refresh button. The scrollbar jumps to the top and the user loses his place. Is there anyway to fix this example, so that I can apply it to my problem? The solution has eluded all of us.

Thanks for any help.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
try editing your post to add code tags around the code, so we can read/copy it in the correct format
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19722
    
  20

It seems as though your table does not get notified properly about the row height initially. I tried it full screen on a 2560x1600 resolution, and refreshing decreased the sroll bar button with around 10 pixels. If I remove the call to table.setRowHeight that no longer occurs.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: erratic scrolling behavior with JTable with variable height rows