I am using FlowLayout and I want my components to be "flow" from the top left of my frame to the bottom right instead of starting in the center of the screen. GridLayout does this fine, but it re-adjusts the size of my components and I don't like that. I would use GridBagLayout but it is so complicated I wanted to see If it is possible to do what I want with FlowLayout.
You can pass it as parameter to the constructor
new FlowLayout(FlowLayout.LEADING);
Edit: After having the code I recognized that the vertical alignment is your issue. You should switch to another layout to fix this, e.g.:
contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.X_AXIS));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With