Example usage for java.awt ComponentOrientation getOrientation

List of usage examples for java.awt ComponentOrientation getOrientation

Introduction

In this page you can find the example usage for java.awt ComponentOrientation getOrientation.

Prototype

@Deprecated
public static ComponentOrientation getOrientation(ResourceBundle bdl) 

Source Link

Document

Returns the orientation appropriate for the given ResourceBundle's localization.

Usage

From source file:net.pms.newgui.NavigationShareTab.java

public JComponent build() {
    // Apply the orientation for the locale
    ComponentOrientation orientation = ComponentOrientation.getOrientation(PMS.getLocale());
    String colSpec = FormLayoutUtil.getColSpec(PANEL_COL_SPEC, orientation);

    // Set basic layout
    FormLayout layout = new FormLayout(colSpec, PANEL_ROW_SPEC);
    PanelBuilder builder = new PanelBuilder(layout);
    builder.border(Borders.DLU4);//ww w  .  j a  v  a  2s  . c  om
    builder.opaque(true);

    CellConstraints cc = new CellConstraints();

    // Init all gui components
    initSimpleComponents(cc);
    sharedPanel = initSharedFoldersGuiComponents(cc).build();

    // Build gui with initialized components
    if (!configuration.isHideAdvancedOptions()) {
        JComponent cmp = builder.addSeparator(Messages.getString("FoldTab.13"),
                FormLayoutUtil.flip(cc.xyw(1, 1, 12), colSpec, orientation));
        cmp = (JComponent) cmp.getComponent(0);
        cmp.setFont(cmp.getFont().deriveFont(Font.BOLD));

        builder.add(GuiUtil.getPreferredSizeComponent(thumbgenCheckBox),
                FormLayoutUtil.flip(cc.xyw(1, 3, 3), colSpec, orientation));
        builder.addLabel(Messages.getString("NetworkTab.16"),
                FormLayoutUtil.flip(cc.xyw(4, 3, 2), colSpec, orientation));
        builder.add(seekpos, FormLayoutUtil.flip(cc.xy(6, 3), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(image_thumb),
                FormLayoutUtil.flip(cc.xyw(9, 3, 4), colSpec, orientation));

        builder.addLabel(Messages.getString("FoldTab.26"),
                FormLayoutUtil.flip(cc.xyw(1, 5, 3), colSpec, orientation));
        builder.add(audiothumbnail, FormLayoutUtil.flip(cc.xyw(4, 5, 3), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(mplayer_thumb),
                FormLayoutUtil.flip(cc.xyw(9, 5, 4), colSpec, orientation));

        builder.addLabel(Messages.getString("FoldTab.27"),
                FormLayoutUtil.flip(cc.xy(1, 7), colSpec, orientation));
        builder.add(defaultThumbFolder, FormLayoutUtil.flip(cc.xyw(4, 7, 2), colSpec, orientation));
        builder.add(select, FormLayoutUtil.flip(cc.xy(6, 7), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(dvdiso_thumb),
                FormLayoutUtil.flip(cc.xyw(9, 7, 4), colSpec, orientation));

        cmp = builder.addSeparator(Messages.getString("NetworkTab.59"),
                FormLayoutUtil.flip(cc.xyw(1, 9, 12), colSpec, orientation));
        cmp = (JComponent) cmp.getComponent(0);
        cmp.setFont(cmp.getFont().deriveFont(Font.BOLD));

        builder.addLabel(Messages.getString("FoldTab.18"),
                FormLayoutUtil.flip(cc.xyw(1, 11, 3), colSpec, orientation));
        builder.add(sortmethod, FormLayoutUtil.flip(cc.xyw(4, 11, 3), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(ignorethewordthe),
                FormLayoutUtil.flip(cc.xyw(9, 11, 4), colSpec, orientation));

        builder.add(GuiUtil.getPreferredSizeComponent(prettifyfilenames),
                FormLayoutUtil.flip(cc.xyw(1, 13, 5), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(episodeTitles),
                FormLayoutUtil.flip(cc.xyw(9, 13, 4), colSpec, orientation));

        cmp = builder.addSeparator(Messages.getString("NetworkTab.60"),
                FormLayoutUtil.flip(cc.xyw(1, 15, 12), colSpec, orientation));
        cmp = (JComponent) cmp.getComponent(0);
        cmp.setFont(cmp.getFont().deriveFont(Font.BOLD));

        builder.add(GuiUtil.getPreferredSizeComponent(hideextensions),
                FormLayoutUtil.flip(cc.xyw(1, 17, 3), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(hideengines),
                FormLayoutUtil.flip(cc.xyw(4, 17, 3), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(hideemptyfolders),
                FormLayoutUtil.flip(cc.xyw(9, 17, 4), colSpec, orientation));

        builder.add(GuiUtil.getPreferredSizeComponent(itunes),
                FormLayoutUtil.flip(cc.xy(1, 19), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(iphoto),
                FormLayoutUtil.flip(cc.xyw(4, 19, 3), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(aperture),
                FormLayoutUtil.flip(cc.xyw(9, 19, 4), colSpec, orientation));

        builder.add(GuiUtil.getPreferredSizeComponent(cacheenable),
                FormLayoutUtil.flip(cc.xy(1, 21), colSpec, orientation));
        builder.add(cachereset, FormLayoutUtil.flip(cc.xyw(4, 21, 3), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(isShowFolderMediaLibrary),
                FormLayoutUtil.flip(cc.xyw(9, 21, 4), colSpec, orientation));

        builder.add(GuiUtil.getPreferredSizeComponent(archive),
                FormLayoutUtil.flip(cc.xyw(1, 23, 3), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(isShowFolderServerSettings),
                FormLayoutUtil.flip(cc.xyw(4, 23, 3), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(isShowFolderTranscode),
                FormLayoutUtil.flip(cc.xyw(9, 23, 4), colSpec, orientation));

        builder.add(GuiUtil.getPreferredSizeComponent(isShowFolderLiveSubtitles),
                FormLayoutUtil.flip(cc.xyw(1, 25, 3), colSpec, orientation));
        builder.addLabel(Messages.getString("FoldTab.37"),
                FormLayoutUtil.flip(cc.xyw(4, 25, 2), colSpec, orientation));
        builder.add(atzLimit, FormLayoutUtil.flip(cc.xy(6, 25), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(isShowFolderNewMedia),
                FormLayoutUtil.flip(cc.xyw(9, 25, 4), colSpec, orientation));

        builder.add(GuiUtil.getPreferredSizeComponent(resume),
                FormLayoutUtil.flip(cc.xy(1, 27), colSpec, orientation));
        builder.add(GuiUtil.getPreferredSizeComponent(isShowFolderRecentlyPlayed),
                FormLayoutUtil.flip(cc.xyw(9, 27, 4), colSpec, orientation));

        builder.addLabel(Messages.getString("FoldTab.72"),
                FormLayoutUtil.flip(cc.xy(1, 29), colSpec, orientation));
        builder.add(fullyPlayedAction, FormLayoutUtil.flip(cc.xyw(4, 29, 3), colSpec, orientation));
        builder.add(fullyPlayedOutputDirectory, FormLayoutUtil.flip(cc.xyw(9, 29, 2), colSpec, orientation));
        builder.add(selectFullyPlayedOutputDirectory,
                FormLayoutUtil.flip(cc.xyw(11, 29, 2), colSpec, orientation));

        builder.add(sharedPanel, FormLayoutUtil.flip(cc.xyw(1, 31, 12), colSpec, orientation));
    } else {
        builder.add(sharedPanel, FormLayoutUtil.flip(cc.xyw(1, 1, 12), colSpec, orientation));
    }

    builder.add(sharedPanel, FormLayoutUtil.flip(cc.xyw(1, 31, 12), colSpec, orientation));

    JPanel panel = builder.getPanel();

    // Apply the orientation to the panel and all components in it
    panel.applyComponentOrientation(orientation);

    JScrollPane scrollPane = new JScrollPane(panel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    scrollPane.setBorder(BorderFactory.createEmptyBorder());
    return scrollPane;
}

From source file:net.pms.newgui.LanguageSelection.java

private void setStrings() {
    dialog.setLocale(locale);//from  w  ww .j  ava2s . c o  m
    dialog.applyComponentOrientation(ComponentOrientation.getOrientation(locale));

    selectionPanelBorder.setTitle(buildString("LanguageSelection.1"));

    selectionPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5),
            BorderFactory.createCompoundBorder(selectionPanelBorder,
                    BorderFactory.createEmptyBorder(10, 5, 10, 5))));

    String descriptionMessage = parentComponent != null ? "LanguageSelection.7" : "LanguageSelection.2";
    if (Messages.getString(descriptionMessage, locale).equals(Messages.getRootString(descriptionMessage))) {
        if (parentComponent != null) {
            descriptionText.setText(String.format(Messages.getString(descriptionMessage, locale), PMS.NAME));
        } else {
            descriptionText.setText(String.format(Messages.getString(descriptionMessage, locale), PMS.NAME,
                    Messages.getString("LooksFrame.20", locale)));
        }
    } else {
        if (parentComponent != null) {
            descriptionText.setText(String.format(buildString(descriptionMessage, true), PMS.NAME, PMS.NAME));
        } else {
            descriptionText.setText(String.format(buildString(descriptionMessage, true), PMS.NAME,
                    Messages.getString("LooksFrame.20", locale), PMS.NAME,
                    Messages.getRootString("LooksFrame.20")));
        }
    }
    // Set the width of the text panels by font size to accommodate font scaling
    float avgCharWidth = SwingUtils.getComponentAverageCharacterWidth(descriptionText);
    textWidth = Math.round(avgCharWidth * 100);
    selectButton.setMargin(new Insets(Math.round((float) 0.5 * avgCharWidth), Math.round(4 * avgCharWidth),
            Math.round((float) 0.5 * avgCharWidth), Math.round(4 * avgCharWidth)));
    applyButton.setMargin(new Insets(Math.round((float) 0.5 * avgCharWidth), Math.round(4 * avgCharWidth),
            Math.round((float) 0.5 * avgCharWidth), Math.round(4 * avgCharWidth)));

    descriptionText.setPreferredSize(SwingUtils.getWordWrappedTextDimension(descriptionText, textWidth));

    keyedModel.setData(Languages.getLanguageTags(locale), Languages.getLanguageNames(locale));
    //Try to find a matching locale
    String languageTag = Languages.toLanguageTag(locale);
    int idx;
    if (languageTag != null) {
        idx = keyedModel.findKeyIndex(languageTag);
    } else {
        idx = -1;
    }
    if (idx < 0) {
        // Trying to translate a close match to "our" definition
        Locale tmpLocale = Languages.toLocale(locale);
        if (tmpLocale == null) {
            // Trying to find a supported locale based only on language and country
            tmpLocale = Languages.toLocale(new Locale(locale.getLanguage(), locale.getCountry()));
            if (tmpLocale == null) {
                // Trying to find a supported locale based only on language
                tmpLocale = Languages.toLocale(new Locale(locale.getLanguage()));
                if (tmpLocale == null) {
                    // Giving up, defaulting to US English
                    tmpLocale = Languages.toLocale("en-US");
                }
            }
        }
        // We should be guaranteed to get a valid tag here
        languageTag = Languages.toLanguageTag(tmpLocale);
    }
    keyedModel.setSelectedKey(languageTag);

    if (keyedModel.getSelectedKey() != null && Languages.warnCoverage(keyedModel.getSelectedKey())) {
        String localizedLanguageName = Messages.getString("Language." + keyedModel.getSelectedKey(), locale);
        if (Messages.getString("LanguageSelection.3", locale)
                .equals(Messages.getRootString("LanguageSelection.3"))) {
            warningText.setText(
                    String.format(Messages.getString("LanguageSelection.3", locale), localizedLanguageName,
                            Languages.getLanguageCoverage(keyedModel.getSelectedKey()), localizedLanguageName));
        } else {
            int coverage = Languages.getLanguageCoverage(keyedModel.getSelectedKey());
            String rootLanguageName = Messages.getRootString("Language." + keyedModel.getSelectedKey());
            warningText.setText(String.format(buildString("LanguageSelection.3", true), localizedLanguageName,
                    coverage, localizedLanguageName, rootLanguageName, coverage, rootLanguageName));
        }
    } else {
        warningText.setText("");
    }
    warningText.setPreferredSize(SwingUtils.getWordWrappedTextDimension(warningText, textWidth));

    infoTextBorder.setTitle(buildString("LanguageSelection.4"));

    infoText.setText(
            String.format(buildString("LanguageSelection.5", true, true), PMS.CROWDIN_LINK, PMS.CROWDIN_LINK));
    infoText.setPreferredSize(SwingUtils.getWordWrappedTextDimension(infoText, textWidth,
            StringUtil.stripHTML(infoText.getText())));

    selectButton.setText(buildString("Dialog.Select"));
    applyButton.setText(buildString("Dialog.Apply"));
}

From source file:gg.pistol.sweeper.gui.component.DecoratedPanel.java

/**
 * Helper factory method for creating clickable links.
 *
 * @param linkText/*from  ww  w .  jav a  2  s  .  com*/
 *         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;
}

From source file:gg.pistol.sweeper.gui.component.DecoratedPanel.java

private <T extends JComponent> T alignHorizontally(T component, float alignment) {
    Preconditions.checkNotNull(component);

    if (!ComponentOrientation.getOrientation(i18n.getLocale()).isLeftToRight()) {
        if (alignment == Component.LEFT_ALIGNMENT) {
            alignment = Component.RIGHT_ALIGNMENT;
        } else if (alignment == Component.RIGHT_ALIGNMENT) {
            alignment = Component.LEFT_ALIGNMENT;
        }/*from w  w  w .  j  a  v a  2 s .  c  o m*/
    }
    component.setComponentOrientation(ComponentOrientation.getOrientation(i18n.getLocale()));
    component.setAlignmentX(alignment);
    return component;
}

From source file:gg.pistol.sweeper.gui.component.DecoratedPanel.java

/**
 * Helper factory method for creating a horizontal box layout {@link JPanel} that takes into account the locale.
 *
 * @return the created panel/*from   w w w .j  a  v  a  2s . c om*/
 */
protected JPanel createHorizontalPanel() {
    JPanel panel = new JPanel();
    panel.setComponentOrientation(ComponentOrientation.getOrientation(i18n.getLocale()));
    panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));
    return panel;
}

From source file:net.pms.encoders.VLCVideo.java

@Override
public JComponent config() {
    // Apply the orientation for the locale
    Locale locale = new Locale(configuration.getLanguage());
    ComponentOrientation orientation = ComponentOrientation.getOrientation(locale);
    String colSpec = FormLayoutUtil.getColSpec("right:pref, 3dlu, pref:grow, 7dlu, right:pref, 3dlu, pref:grow",
            orientation);//from ww  w.j a  v a  2 s.  c  o  m
    FormLayout layout = new FormLayout(colSpec, "");
    // Here goes my 3rd try to learn JGoodies Form
    layout.setColumnGroups(new int[][] { { 1, 5 }, { 3, 7 } });
    DefaultFormBuilder mainPanel = new DefaultFormBuilder(layout);

    mainPanel.appendSeparator(Messages.getString("VlcTrans.1"));
    mainPanel.append(experimentalCodecs = new JCheckBox(Messages.getString("VlcTrans.3"),
            configuration.isVlcExperimentalCodecs()), 3);
    experimentalCodecs.setContentAreaFilled(false);
    experimentalCodecs.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setVlcExperimentalCodecs(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    mainPanel.append(audioSyncEnabled = new JCheckBox(Messages.getString("VlcTrans.4"),
            configuration.isVlcAudioSyncEnabled()), 3);
    audioSyncEnabled.setContentAreaFilled(false);
    audioSyncEnabled.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            configuration.setVlcAudioSyncEnabled(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    mainPanel.nextLine();

    // Developer stuff. Theoretically is temporary 
    mainPanel.appendSeparator(Messages.getString("VlcTrans.10"));

    // Add scale as a subpanel because it has an awkward layout
    mainPanel.append(Messages.getString("VlcTrans.11"));
    FormLayout scaleLayout = new FormLayout("pref,3dlu,pref", "");
    DefaultFormBuilder scalePanel = new DefaultFormBuilder(scaleLayout);
    double startingScale = Double.valueOf(configuration.getVlcScale());
    scalePanel.append(scale = new JTextField(String.valueOf(startingScale)));
    final JSlider scaleSlider = new JSlider(JSlider.HORIZONTAL, 0, 10, (int) (startingScale * 10));
    scalePanel.append(scaleSlider);
    scaleSlider.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent ce) {
            String value = String.valueOf((double) scaleSlider.getValue() / 10);
            scale.setText(value);
            configuration.setVlcScale(value);
        }
    });
    scale.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            String typed = scale.getText();
            if (!typed.matches("\\d\\.\\d")) {
                return;
            }
            double value = Double.parseDouble(typed);
            scaleSlider.setValue((int) (value * 10));
            configuration.setVlcScale(String.valueOf(value));
        }
    });
    mainPanel.append(scalePanel.getPanel(), 3);

    // Audio sample rate
    FormLayout sampleRateLayout = new FormLayout(
            "right:pref, 3dlu, right:pref, 3dlu, right:pref, 3dlu, left:pref", "");
    DefaultFormBuilder sampleRatePanel = new DefaultFormBuilder(sampleRateLayout);
    sampleRateOverride = new JCheckBox(Messages.getString("VlcTrans.17"),
            configuration.getVlcSampleRateOverride());
    sampleRatePanel.append(Messages.getString("VlcTrans.18"), sampleRateOverride);
    sampleRate = new JTextField(configuration.getVlcSampleRate(), 8);
    sampleRate.setEnabled(configuration.getVlcSampleRateOverride());
    sampleRate.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            configuration.setVlcSampleRate(sampleRate.getText());
        }
    });
    sampleRatePanel.append(Messages.getString("VlcTrans.19"), sampleRate);
    sampleRateOverride.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            boolean checked = e.getStateChange() == ItemEvent.SELECTED;
            configuration.setVlcSampleRateOverride(checked);
            sampleRate.setEnabled(checked);
        }
    });

    mainPanel.nextLine();
    mainPanel.append(sampleRatePanel.getPanel(), 7);

    // Extra options
    mainPanel.nextLine();
    mainPanel.append(Messages.getString("VlcTrans.20"), extraParams = new JTextField(), 5);

    return mainPanel.getPanel();
}

From source file:gg.pistol.sweeper.gui.component.DecoratedPanel.java

/**
 * Helper method to add an internationalized scroll pane (that is sensible to the left-to-right or right-to-left
 * languages) to the provided {@code component}.
 *
 * @param component//from   w ww  .java 2s.c om
 *         the component to wrap inside the scroll pane
 * @return the newly created scroll pane that wraps the provided {@code component}
 */
protected JComponent addScrollPane(JComponent component) {
    Preconditions.checkNotNull(component);
    JScrollPane scrollPane = new JScrollPane(component);
    scrollPane.setComponentOrientation(ComponentOrientation.getOrientation(i18n.getLocale()));
    return scrollPane;
}

From source file:gg.pistol.sweeper.gui.component.DecoratedPanel.java

/**
 * Helper factory method for creating a language selector that provides functionality to change the locale.
 *
 * @param width/*from ww w  . ja  v  a 2  s .  co m*/
 *         the preferred width of the component in pixels
 * @return the newly created language selector
 */
protected JComboBox createLanguageSelector(int width) {
    Preconditions.checkArgument(width >= 0);
    final JComboBox<SupportedLocale> selector = new JComboBox(i18n.getSupportedLocales().toArray());
    selector.setSelectedItem(i18n.getCurrentSupportedLocale());
    selector.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            i18n.setLocale((SupportedLocale) selector.getSelectedItem());
        }
    });
    int height = selector.getPreferredSize().height;
    selector.setMinimumSize(new Dimension(width, height));
    selector.setMaximumSize(new Dimension(width, height));
    selector.setPreferredSize(new Dimension(width, height));
    selector.setMaximumRowCount(i18n.getSupportedLocales().size());
    selector.setComponentOrientation(ComponentOrientation.getOrientation(i18n.getLocale()));
    return selector;
}

From source file:net.pms.newgui.LooksFrame.java

public JComponent buildContent() {
    JPanel panel = new JPanel(new BorderLayout());
    JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);//from  w w  w  .j  a  v a 2  s  . com
    toolBar.setRollover(true);

    toolBar.add(new JPanel());

    if (PMS.getConfiguration().useWebInterface()) {
        webinterface = createToolBarButton(Messages.getString("LooksFrame.29"), "button-wif.png");
        webinterface.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                String error = null;
                if (PMS.get().getWebInterface() != null && isNotBlank(PMS.get().getWebInterface().getUrl())) {
                    try {
                        URI uri = new URI(PMS.get().getWebInterface().getUrl());
                        try {
                            Desktop.getDesktop().browse(uri);
                        } catch (RuntimeException | IOException be) {
                            LOGGER.error("Cound not open the default web browser: {}", be.getMessage());
                            LOGGER.trace("", be);
                            error = Messages.getString("LooksFrame.BrowserError") + "\n" + be.getMessage();
                        }
                    } catch (URISyntaxException se) {
                        LOGGER.error("Could not form a valid web interface URI from \"{}\": {}",
                                PMS.get().getWebInterface().getUrl(), se.getMessage());
                        LOGGER.trace("", se);
                        error = Messages.getString("LooksFrame.URIError");
                    }
                } else {
                    error = Messages.getString("LooksFrame.URIError");
                }
                if (error != null) {
                    JOptionPane.showMessageDialog(null, error, Messages.getString("Dialog.Error"),
                            JOptionPane.ERROR_MESSAGE);
                }
            }
        });
        webinterface.setToolTipText(Messages.getString("LooksFrame.30"));
        webinterface.setEnabled(configuration.useWebInterface());
        toolBar.add(webinterface);
        toolBar.addSeparator(new Dimension(20, 1));
    }

    restartIcon = (AnimatedIcon) reload.getIcon();
    restartRequredIcon.start();
    setReloadable(false);
    reload.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            reload.setEnabled(false);
            PMS.get().reset();
        }
    });
    reload.setToolTipText(Messages.getString("LooksFrame.28"));
    toolBar.add(reload);

    toolBar.addSeparator(new Dimension(20, 1));
    AbstractButton quit = createToolBarButton(Messages.getString("LooksFrame.5"), "button-quit.png");
    quit.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            quit();
        }
    });
    toolBar.add(quit);
    if (System.getProperty(START_SERVICE) != null) {
        quit.setEnabled(false);
    }
    toolBar.add(new JPanel());

    // Apply the orientation to the toolbar and all components in it
    ComponentOrientation orientation = ComponentOrientation.getOrientation(PMS.getLocale());
    toolBar.applyComponentOrientation(orientation);
    toolBar.setBorder(new EmptyBorder(new Insets(8, 0, 0, 0)));

    panel.add(toolBar, BorderLayout.NORTH);
    panel.add(buildMain(), BorderLayout.CENTER);
    status = new JLabel("");
    status.setBorder(BorderFactory.createEmptyBorder());
    status.setComponentOrientation(orientation);

    // Calling applyComponentOrientation() here would be ideal.
    // Alas it horribly mutilates the layout of several tabs.
    //panel.applyComponentOrientation(orientation);
    panel.add(status, BorderLayout.SOUTH);

    return panel;
}

From source file:net.pms.newgui.LooksFrame.java

public JComponent buildMain() {
    final JTabbedPane tabbedPane = new JTabbedPane(SwingConstants.TOP);

    tabbedPane.setUI(new CustomTabbedPaneUI());

    st = new StatusTab(configuration);
    tt = new TracesTab(configuration, this);
    gt = new GeneralTab(configuration, this);
    nt = new NavigationShareTab(configuration, this);
    tr = new TranscodingTab(configuration, this);
    ht = new HelpTab();

    tabbedPane.addTab(Messages.getString("LooksFrame.18"), st.build());
    tabbedPane.addTab(Messages.getString("LooksFrame.19"), tt.build());
    tabbedPane.addTab(Messages.getString("LooksFrame.20"), gt.build());
    tabbedPane.addTab(Messages.getString("LooksFrame.22"), nt.build());
    if (!configuration.isDisableTranscoding()) {
        tabbedPane.addTab(Messages.getString("LooksFrame.21"), tr.build());
    } else {/*from   w  w w. j a  v  a 2  s.  co  m*/
        tr.build();
    }
    tabbedPane.addTab(Messages.getString("LooksFrame.24"), new HelpTab().build());
    tabbedPane.addTab(Messages.getString("LooksFrame.25"), new AboutTab().build());

    tabbedPane.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            int selectedIndex = tabbedPane.getSelectedIndex();

            if (HELP_PAGES[selectedIndex] != null) {
                PMS.setHelpPage(HELP_PAGES[selectedIndex]);

                // Update the contents of the help tab itself
                ht.updateContents();
            }
        }
    });

    tabbedPane.setBorder(new EmptyBorder(5, 5, 5, 5));

    /*
     * Set the orientation of the tabbedPane.
     * Note: Do not use applyComponentOrientation() here because it
     * messes with the layout of several tabs.
     */
    ComponentOrientation orientation = ComponentOrientation.getOrientation(PMS.getLocale());
    tabbedPane.setComponentOrientation(orientation);

    return tabbedPane;
}