• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to : scrollbar always at the bottom

 
prabhat gupta
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have designed a chat application in which i have used a jtextpane which is placed inside a jscrollpane .I would like to know as how to keep the srollbar always at the bottom so that the user does not have to use the mouse in order to see what new messages are being posted.Does the scrollbar by default remains at the bottom,I guess it does,please help.
 
Johannes Hartman
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prabhat
You could force the scrollbar to be there "always" by using the setScrollBarPolicy(JScrollPane.HorizontalScrollBarPolicy.ALWAYS).
The scrollbar does not remain at the bottom by default -- you could use the scrollToVisible method to scroll to the desired location....
cheers!
 
prabhat gupta
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Johannes
that really works.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!