I have a JScrollPane containing a JPanel and, in turn, a JList. I want for the viewport to always show the end of the list (from which items are being removed or added). I can accomplish this manually by dragging the ScrollBar to the bottom, where it stays, just the way I want it to. What should I do to accomplish this automatically?
It should be simple to do. Just use JList's ensureIndexIsVisible method and pass it the last index in the list (size - 1).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With