I believe that instead of:
wrapper2.setLayout(new BoxLayout(wrapper1, BoxLayout.Y_AXIS));
You want to do:
wrapper2.setLayout(new BoxLayout(wrapper2, BoxLayout.Y_AXIS));
For now, you create a new BoxLayout
with wrapper1
for parent and try to "share" it by making it the layout of wrapper2
. It's just a mistyping (or most probably some omission after a quick copy/paste) :p