Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JScrollPane and JPanel  RSS feed

 
Titus Abraham
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey ,

I am having a JPanel within a JScrollPane and i am keeping adding components to JPanel. such tat i can see that JPanel becomes bigger but I dont know how to make the JScroll pane auto scroll to bottom .. Any Idea ?


Thanks in advance..

Best regards,
 
Rob Camick
Ranch Hand
Posts: 2752
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Invoke the scrollRectToVisible(...) method on the panel, using the components bounds as the rectangle.

Edit: Also, you will need to invoke the above method in a SwingUtilities.invokeLater();
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or retrieve the JScrollPane's vertical JScrollBar, and set its value to its maximum.
 
Titus Abraham
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a ton .. Its working.. (Sorry for late reply..)
 
Titus Abraham
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you Rob Prime and Rob Camick
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!