Example usage for javax.swing JLabel setComponentOrientation

List of usage examples for javax.swing JLabel setComponentOrientation

Introduction

In this page you can find the example usage for javax.swing JLabel 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:gg.pistol.sweeper.gui.component.DecoratedPanel.java

/**
 * Helper factory method for creating clickable links.
 *
 * @param linkText//from   w  w w . j  a v  a  2s.c o  m
 *         a string that will be displayed as a link
 * @param action
 *         the action performed at click
 * @return the link component
 */
protected JComponent createLink(String linkText, final Runnable action) {
    Preconditions.checkNotNull(linkText);
    Preconditions.checkNotNull(action);

    JLabel link = new JLabel("<html><a href=''>" + linkText + "</a></html>");
    link.setComponentOrientation(ComponentOrientation.getOrientation(i18n.getLocale()));
    link.setCursor(new Cursor(Cursor.HAND_CURSOR));
    link.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            action.run();
        }
    });
    return link;
}