So I'm making a program as a project for school. In this program I have a panel inside a scrollpane. When I click a button a panel with info is added to the panel inside the scrollpane. I can keep adding as much of these panels as I want.
I set the layout of the panel to FlowLayout. I disabled the horizontal scrolling and set the width of the panel to the width of the scrollpane so I neatly get two of those 'forms' next to each other before it starts a new row of panels. Problem is the vertical scrolling doesn't activate so I can see only 1,5 rows of panels. (see picture)
I suspect this has something to do with the height of the main panel I had to define if I wanted to set a width. Ideally there should be an option to set the height to 'automatic', but there isn't.
I know scrolling works because when I enable horizontal scrolling and don't set any dimensions for the panel it just keeps adding forms in a single row which I can scroll through.
I think I might need to use another LayoutManager (but I don't have any experience setting those up) or change some of the settings of the scrollpane or main panel. Can someone help me with this?