• Post Reply Bookmark Topic Watch Topic
  • New Topic

Making JScrollPane autoscroll slowly  RSS feed

 
Andrew Cho
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey all,

I have a JTable in a JScrollPane, and I want to have it start scrolling downwards slowly when the application or applet loads. I've looked all over the internet and couldn't find a way, so what I did was make a javax.swing.Timer call moving it down a pixel every 70 milliseconds. this seems kind of inefficient and doesn't work when run on mac (works well on PC though).

Any ideas of a better way to make it autoscroll at a rate I can control?
Thanks,
Andrew
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two other methods of scrolling programatically are
  • scrollRectToVisible(...) of the component contained in the scroll pane
  • setValue(...) of the scroll bar

  •  
    Andrew Cho
    Ranch Hand
    Posts: 50
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks Darryl, I'll try to make use of those. There is no way to auto scroll without a swing timer though?
     
    Darryl Burke
    Bartender
    Posts: 5167
    11
    Java Netbeans IDE Opera
    • Likes 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Well, you could theoretically 'auto' scroll using a java.awt.Robot and a whole lot of ugly code (and annoy the user in the process), but why would you want to?
     
    Andrew Cho
    Ranch Hand
    Posts: 50
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Well for some reason it didn't work well on Macs, and since this is going to go on a website, I need it to work for all platforms. I don't know, it could have been the computer I was on though. I'll give it another run though.
    Thanks for your help,
    Andrew
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!