FlowLayout.LEADING
is depending on the orientation of the container.
import java.awt.ComponentOrientation; import java.awt.Container; import java.awt.FlowLayout; import javax.swing.JButton; import javax.swing.JFrame; public class Main { public static void main(String[] args) { int horizontalGap = 20; int verticalGap = 10; JFrame frame = new JFrame("Flow Layout Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container contentPane = frame.getContentPane(); FlowLayout flowLayout = new FlowLayout(FlowLayout.LEADING, horizontalGap, verticalGap); contentPane.setLayout(flowLayout); frame.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); for (int i = 1; i <= 3; i++) { contentPane.add(new JButton("Button " + i)); }/*from w w w. j a va 2 s .c o m*/ frame.pack(); frame.setVisible(true); } }