Skip to content

Commit

Permalink
Settings: If there is no theme currently available (due to no theme b…
Browse files Browse the repository at this point in the history
…eing registered) then we should fallback to the default theme offered by the LafManager
  • Loading branch information
weisJ committed May 17, 2021
1 parent 3c9056f commit 4ef86de
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ private JComponent createGeneralSettings(final GroupLayout.Alignment alignment,
JLabel themeLabel = new JLabel(UIManager.getString("label_theme", l));
themeComboBox = new JComboBox<>(LafManager.getThemeComboBoxModel());
themeComboBox.setRenderer(LafManager.getThemeListCellRenderer());
themeComboBox.setSelectedItem(LafManager.getTheme());
settingsConfiguration.setTheme(LafManager.getTheme());

themeComboBox.putClientProperty(ComboBoxConstants.KEY_DO_NOT_UPDATE_WHEN_SCROLLED, true);
themeComboBox.addItemListener(e -> update());
Expand Down Expand Up @@ -603,7 +603,13 @@ private Theme getTheme(final PreferredThemeStyle preferredThemeStyle) {
}

private Theme getSelectedTheme() {
return (Theme) themeComboBox.getSelectedItem();
Theme selected = (Theme) themeComboBox.getSelectedItem();
if (selected == null) {
selected = LafManager.getInstalledTheme();
selected = selected != null ? selected : LafManager.getTheme();
setTheme(selected);
}
return selected;
}

@Override
Expand Down

0 comments on commit 4ef86de

Please sign in to comment.