I am trying to create a JPanel that contains a stack of many JPanels. Each JPanel in this stack is the same size, has some information and a few buttons. If the display was meant to be static, all I would have to do is use BoxLayout and go one after the other -that would be fine. However, the problem is that any individual JPanel needs to be able to be deleted from the stack of JPanels, and new JPanels need to be added to the stack of JPanels on top of the the stack, instead of on the bottom. Therein lies my problem: the layout managers use add() which seems to add to the bottom or right of the other components on the JPanel, instead of on top or to the left. Furthermore, more complex layouts, such as gridbaglayout, also work from 0,0 outward...and there is no "maximum" possible to the number of JPanels, so I can't just set a max value and go backwards with the gridbaglayout.
Is there anyway around this problem, without actually clearing the JPanel and re-adding all of the components? (if so, I can just use BoxLayout()).
Thank you for all your help!