diff --git a/key.ui/src/main/java/de/uka/ilkd/key/gui/settings/StandardUISettings.java b/key.ui/src/main/java/de/uka/ilkd/key/gui/settings/StandardUISettings.java index f183dbc7909..7062ecaa503 100644 --- a/key.ui/src/main/java/de/uka/ilkd/key/gui/settings/StandardUISettings.java +++ b/key.ui/src/main/java/de/uka/ilkd/key/gui/settings/StandardUISettings.java @@ -7,9 +7,7 @@ import de.uka.ilkd.key.settings.ViewSettings; import javax.swing.*; -import javax.swing.plaf.metal.MetalLookAndFeel; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -29,14 +27,12 @@ public class StandardUISettings extends SettingsPanel implements SettingsProvide /** * Labels for the selectable look and feels. Must be kept in sync with {@link #LAF_CLASSES}. */ - private static final String[] LAF_LABELS = new String[] { "System", "Metal" }; + private static final List LAF_LABELS = new ArrayList<>(List.of("System")); /** * Classnames corresponding to the labels in {@link #LAF_LABELS}. */ - private static final String[] LAF_CLASSES = new String[] { - UIManager.getSystemLookAndFeelClassName(), - MetalLookAndFeel.class.getName() - }; + private static final List LAF_CLASSES = + new ArrayList<>(List.of(UIManager.getSystemLookAndFeelClassName())); private final JComboBox lookAndFeel; private final JSpinner spFontSizeGlobal; @@ -60,7 +56,15 @@ public class StandardUISettings extends SettingsPanel implements SettingsProvide public StandardUISettings() { setHeaderText(getDescription()); - lookAndFeel = createSelection(LAF_LABELS, emptyValidator()); + // load all available look and feels + if (LAF_LABELS.size() == 1) { + for (UIManager.LookAndFeelInfo it : UIManager.getInstalledLookAndFeels()) { + LAF_LABELS.add(it.getName()); + LAF_CLASSES.add(it.getClassName()); + } + } + + lookAndFeel = createSelection(LAF_LABELS.toArray(new String[0]), emptyValidator()); addTitledComponent("Look and feel: ", lookAndFeel, LOOK_AND_FEEL_INFO); spFontSizeGlobal = @@ -126,8 +130,8 @@ public JComponent getPanel(MainWindow window) { txtClutterRules.setText(vs.clutterRules().value().replace(',', '\n')); txtClutterRuleSets.setText(vs.clutterRuleSets().value().replace(',', '\n')); - for (int i = 0; i < LAF_CLASSES.length; i++) { - if (LAF_CLASSES[i].equals(vs.getLookAndFeel())) { + for (int i = 0; i < LAF_CLASSES.size(); i++) { + if (LAF_CLASSES.get(i).equals(vs.getLookAndFeel())) { lookAndFeel.setSelectedIndex(i); break; } @@ -161,7 +165,7 @@ public void applySettings(MainWindow window) throws InvalidSettingsInputExceptio ViewSettings vs = ProofIndependentSettings.DEFAULT_INSTANCE.getViewSettings(); GeneralSettings gs = ProofIndependentSettings.DEFAULT_INSTANCE.getGeneralSettings(); - vs.setLookAndFeel(LAF_CLASSES[lookAndFeel.getSelectedIndex()]); + vs.setLookAndFeel(LAF_CLASSES.get(lookAndFeel.getSelectedIndex())); vs.setUIFontSizeFactor((Double) spFontSizeGlobal.getValue()); vs.setMaxTooltipLines((Integer) txtMaxTooltipLines.getValue());