title: How to auto scroll to bottom in Java Swing
body: <p>I have a simple JPanel with a JScrollPane (with vertical scrollbar as needed) on it.</p>
  
  <p>Things get added to (or removed from) the JPanel and when it goes beyond the bottom of the panel, I want the JScrollPane to scroll down to the bottom automatically as needed or scroll up if some components go away from the panel.</p>
  
  <p>How shall I do this? I am guessing I need some kind of listener which gets called whenever the JPanel height changes? Or is there something as simple as <code>JScrollPanel.setAutoScroll(true)</code>?</p>