Example usage for javax.swing JFrame applyComponentOrientation

List of usage examples for javax.swing JFrame applyComponentOrientation

Introduction

In this page you can find the example usage for javax.swing JFrame applyComponentOrientation.

Prototype

public void applyComponentOrientation(ComponentOrientation o) 

Source Link

Document

Sets the ComponentOrientation property of this container and all components contained within it.

Usage

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame("Layout");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    int horizontalGap = 20;
    int verticalGap = 10;
    Container contentPane = frame.getContentPane();
    FlowLayout flowLayout = new FlowLayout(FlowLayout.LEADING, horizontalGap, verticalGap);
    contentPane.setLayout(flowLayout);// w  w  w .  j  ava2  s  .co  m
    frame.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);

    for (int i = 1; i <= 5; i++) {
        contentPane.add(new JButton("Button  " + i));
    }
    frame.pack();
    frame.setVisible(true);
}