public LanguagePanel(ActionListener actionListener){
  setLayout(new BoxLayout(this,BoxLayout.X_AXIS));
  this.actionListener=actionListener;
  this.languageLabel=new JLabel();
  languageOptions=new JComboBox<Object>();
  Font font=new Font("Dialog",Font.PLAIN,11);
  languageOptions.setFont(font);
  Locale[] locales=LanguageUtils.getLocales(font);
  languageOptions.setModel(new DefaultComboBoxModel<Object>(locales));
  languageOptions.setRenderer(LanguageFlagFactory.getListRenderer());
  Locale locale=guessLocale(locales);
  languageOptions.setSelectedItem(locale);
  applySettings(false);
  languageOptions.addItemListener(new StateListener());
  add(languageLabel);
  add(Box.createHorizontalStrut(5));
  add(languageOptions);
}

public LanguagePanel ( ActionListener actionListener ) { setLayout ( new BoxLayout ( this , BoxLayout . X_AXIS ) ) ; this . actionListener = actionListener ; this . languageLabel = new JLabel ( ) ; languageOptions = new JComboBox < Object > ( ) ; Font font = new Font ( "Dialog" , Font . PLAIN , 11 ) ; languageOptions . setFont ( font ) ; Locale [ ] locales = LanguageUtils . getLocales ( font ) ; languageOptions . setModel ( new DefaultComboBoxModel < Object > ( locales ) ) ; languageOptions . setRenderer ( LanguageFlagFactory . getListRenderer ( ) ) ; Locale locale = guessLocale ( locales ) ; languageOptions . setSelectedItem ( locale ) ; applySettings ( false ) ; languageOptions . addItemListener ( new StateListener ( ) ) ; add ( languageLabel ) ; add ( Box . createHorizontalStrut ( 5 ) ) ; add ( languageOptions ) ; }
constructs a languagepanel that will notify the given listener when the language changes .
