LookAndFeelInfo[] infos = UIManager.getInstalledLookAndFeels();
SwingLookAndFeel[] lafs = new SwingLookAndFeel[infos.length];
for (int i = 0; i < infos.length; i++) {
LookAndFeelInfo info = infos[i];
lafs[i] = new SwingLookAndFeel(info.getName(), info.getClassName());
}
lookAndFeelComboBox = new JComboBox<>(lafs);
lookAndFeelComboBox.setRenderer(new SwingLAFRenderer());
try {
SwingLookAndFeel look = SwingLookAndFeel.forName(configManager
.getWindowLAF());
lookAndFeelComboBox.setSelectedItem(look);
} catch (Exception e) {
logger.warning("Unable to set the selected look&feel.");
}
String[] languages = LocaleUtil.getAvailableLocales();
languageComboBox = new JComboBox<>(languages);
languageComboBox.setSelectedItem(configManager.getLanguage());
languageComboBox.setRenderer(new LocaleRender());
okButton = new JButton(Translator.tr("Save"));
okButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
setVisible(false);
SwingLookAndFeel laf = ((SwingLookAndFeel) lookAndFeelComboBox
.getSelectedItem());
configManager.setWindowLAF(laf.getClassName());
SwingUtil.setLookAndFeel(laf.getClassName());
SwingUtilities.updateComponentTreeUI(mainWindow);
Object selectedLanguage = languageComboBox.getSelectedItem();
if (null != selectedLanguage) {
configManager.setLanguage(selectedLanguage.toString());