looking JScrollPane method to default to bottom of list

J

Justin

I have a JScrollPane that holds a JPanel which I am appending items to.
I would like the JScrollPane to automatically scroll to the bottom so
the newly added element will be immediatly visible instead of forcing
the user to manually scroll down. I was looking through the method
list descriptions, but didnt see any. Wondering if I was mistaken or
if not, how to write code to force it to the bottom.

Thanks

Justin
 
T

Thomas Fritsch

Justin said:
I have a JScrollPane that holds a JPanel which I am appending items to.
I would like the JScrollPane to automatically scroll to the bottom so
the newly added element will be immediatly visible instead of forcing
the user to manually scroll down. I was looking through the method
list descriptions, but didnt see any. Wondering if I was mistaken or
if not, how to write code to force it to the bottom.
JScrollPane has the method
public JViewport getViewport();
Look up the API doc of JViewport for a method that suits your need.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,815
Latest member
treekmostly22

Latest Threads

Top