File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

erratic scrolling behavior with JTable with variable height rows

 
Joe Tal
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try editing your post to add code tags around the code, so we can read/copy it in the correct format
 
Rob Spoor
Sheriff
Pie
Posts: 20396
47
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic