I have a program that adds bunch of components to a JPanel
(in JScrollbar
). However, since it adds so many components, most of them don't fit into the visible area (Viewport
).
When everything loads and I start to scroll down, I notice that components, as they get into the Viewport
area, are aligning and setting their positions. That causes my JScrollPane
to be higher than necessary. That makes it "snap" when I get to the end (components abruptly move up (align properly), and so does the viewport).
I tried calling repaint()
and validate()
, but with no effect whatsoever. What am I doing wrong?