This week's book giveaway is in the Artificial Intelligence forum.
We're giving away four copies of Pragmatic AI and have Noah Gift on-line!
See this thread for details.
Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

JScrollPane and JPanel  RSS feed

 
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,
 
Rancher
Posts: 2934
19
  • 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();
 
Sheriff
Posts: 21426
94
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!