Example usage for javax.swing JFrame setComponentOrientation

List of usage examples for javax.swing JFrame setComponentOrientation

Introduction

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

Prototype

public void setComponentOrientation(ComponentOrientation o) 

Source Link

Document

Sets the language-sensitive orientation that is to be used to order the elements or text within this component.

Usage

From source file:Main.java

public static void main(String[] args) {
    FlowLayout layout = new FlowLayout(FlowLayout.LEADING, horizontalGap, verticalGap);
    JButton button = new JButton("Discard");
    JLabel[] panels = new JLabel[5];

    JFrame frame = new JFrame("Poker");
    frame.setSize(width, height);/*from   w w  w  .ja  v  a  2 s.com*/
    frame.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);

    JPanel deckPanel = new JPanel(layout);
    for (int i = 0; i < 5; i++) {
        panels[i] = new JLabel("" + i);
        deckPanel.add(panels[i]);
    }
    frame.getContentPane().add(deckPanel);
    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    buttonPanel.add(button);
    frame.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();

    frame.setVisible(true);
}