I want to add different buttons, vertically stacked, to a JPanel
at run-time and use a JScrollPane
so that all buttons will be visible (with some scrolling).
In order to do this, I have added my JPanel
to a JScrollPane
, after which I add buttons to my JPanel
.
However, when I do this the vertical scrollbar does not allow me to see all images. For example when I add 7 buttons I can only scroll to see 5 full images and half of the 6 images.
Why doesn't my scrollbar allow me to display all 7 buttons?