SyntaxFix
Write A Post
Hire A Developer
Questions
I used a BoxLayout and set its second parameter as BoxLayout.Y_AXIS and it worked for me:
BoxLayout
BoxLayout.Y_AXIS
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));