I got a JViewport correctly scrolling using the default layout manager (using viewport.setViewPosition), but when I call setLayout(null) this no longer works.
Any ideas?
I can give code if needs be, but it’s pretty messy at the moment.
Thanks!
Edit: Thanks for the info so far. I’ve been using a null layout so I can absolutely position components I draw later, is there a way I can do with whilst using a layout manager?
Scroll panes only work when the preferred size of the component added to the scroll pane is greater than the size of the scroll pane.
When you use a null layout, the preferred size is 0, so the scroll pane doesn’t work. That is why you should use a layout manager. It will determine the preferred size for you.