Reputation: 772
I'm having a bit of trouble with JFrame layouts. What I want is this alignment: but what I get with this snippet of code is this:
this.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
this.setLayout(new FlowLayout(FlowLayout.CENTER));
and with this snippet is this:
this.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
this.setLayout(new FlowLayout(FlowLayout.LEFT));
How can I get the ideal (where each row is centered but the icons start from the left side)?
EDIT: It's a bit hard to see the difference between the first and the last, but just open the images in a new tab and CTRL-TAB between them to see what I mean. In the first image, the entire thing is centered in the screen while in the third the icons are left-aligned. The second has ALL icons centered.
Upvotes: 0
Views: 96
Reputation: 772
Alright, so I ended up just adding the images to a JPanel with the same left-to-right formatting as the third example and centering that JPanel. Simple fix.
Upvotes: 1