List of usage examples for javax.swing JComboBox setComponentOrientation
public void setComponentOrientation(ComponentOrientation o)
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 . j a v a 2 s .c o 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; }