I would like to stack JPanels on in the same direction. I've searched this and can't find anything. The results that show up mean "overlap".
This is what I mean:
I would like to stack the second JPanel underneath the first. When using: add(BorderLayout.NORTH)
on both layouts it overlaps them.
I appreciate any help, thanks!
How I usually code something specific like this, I like to use the GridLayout , and set it to 2 Rows and 1 Column like so.
//this will go with the boiler plate
this.setlayout(new GridLayout(2,1));
This should fix the problem of the two JPanels, and you can always add more to the rows if needed.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.