|
20 | 20 |
|
21 | 21 | import org.jabref.gui.GUIGlobals;
|
22 | 22 | import org.jabref.logic.l10n.Localization;
|
23 |
| -import org.jabref.logic.util.OS; |
24 | 23 | import org.jabref.preferences.JabRefPreferences;
|
25 | 24 |
|
26 | 25 | import com.jgoodies.forms.builder.DefaultFormBuilder;
|
|
32 | 31 | class AppearancePrefsTab extends JPanel implements PrefsTab {
|
33 | 32 |
|
34 | 33 | private static final Logger LOGGER = LoggerFactory.getLogger(AppearancePrefsTab.class);
|
| 34 | + private static final String GTK_LF_CLASSNAME = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; |
35 | 35 |
|
36 | 36 | private final JabRefPreferences prefs;
|
37 | 37 |
|
@@ -59,7 +59,10 @@ class AppearancePrefsTab extends JPanel implements PrefsTab {
|
59 | 59 | static class LookAndFeel {
|
60 | 60 |
|
61 | 61 | public static Set<String> getAvailableLookAndFeels() {
|
62 |
| - return Arrays.stream(UIManager.getInstalledLookAndFeels()).map(LookAndFeelInfo::getClassName).collect(Collectors.toSet()); |
| 62 | + return Arrays.stream(UIManager.getInstalledLookAndFeels()) |
| 63 | + .map(LookAndFeelInfo::getClassName) |
| 64 | + .filter(style -> !GTK_LF_CLASSNAME.equals(style)) |
| 65 | + .collect(Collectors.toSet()); |
63 | 66 | }
|
64 | 67 | }
|
65 | 68 |
|
@@ -98,46 +101,46 @@ public AppearancePrefsTab(JabRefPreferences prefs) {
|
98 | 101 | fxFontTweaksLAF = new JCheckBox(Localization.lang("Tweak font rendering for entry editor on Linux"));
|
99 | 102 | // Only list L&F which are available
|
100 | 103 | Set<String> lookAndFeels = LookAndFeel.getAvailableLookAndFeels();
|
| 104 | + |
101 | 105 | classNamesLAF = new JComboBox<>(lookAndFeels.toArray(new String[lookAndFeels.size()]));
|
102 | 106 | classNamesLAF.setEditable(true);
|
103 | 107 | customLAF.addChangeListener(e -> classNamesLAF.setEnabled(((JCheckBox) e.getSource()).isSelected()));
|
104 | 108 |
|
105 | 109 | colorPanel = new ColorSetupPanel(colorCodes, resolvedColorCodes, showGrid);
|
106 | 110 |
|
107 |
| - // only the default L&F shows the OSX specific first drop-down menu |
108 |
| - if (!OS.OS_X) { |
109 |
| - JPanel pan = new JPanel(); |
110 |
| - builder.appendSeparator(Localization.lang("Look and feel")); |
111 |
| - JLabel lab = new JLabel( |
112 |
| - Localization.lang("Default look and feel") + ": " + UIManager.getSystemLookAndFeelClassName()); |
113 |
| - builder.nextLine(); |
114 |
| - builder.append(pan); |
115 |
| - builder.append(lab); |
116 |
| - builder.nextLine(); |
117 |
| - builder.append(pan); |
118 |
| - builder.append(customLAF); |
119 |
| - builder.nextLine(); |
120 |
| - builder.append(pan); |
121 |
| - JPanel pan2 = new JPanel(); |
122 |
| - lab = new JLabel(Localization.lang("Class name") + ':'); |
123 |
| - pan2.add(lab); |
124 |
| - pan2.add(classNamesLAF); |
125 |
| - builder.append(pan2); |
126 |
| - builder.nextLine(); |
127 |
| - builder.append(pan); |
128 |
| - lab = new JLabel(Localization |
129 |
| - .lang("Note that you must specify the fully qualified class name for the look and feel,")); |
130 |
| - builder.append(lab); |
131 |
| - builder.nextLine(); |
132 |
| - builder.append(pan); |
133 |
| - lab = new JLabel( |
134 |
| - Localization.lang("and the class must be available in your classpath next time you start JabRef.")); |
135 |
| - builder.append(lab); |
136 |
| - builder.nextLine(); |
137 |
| - builder.append(pan); |
138 |
| - builder.append(fxFontTweaksLAF); |
139 |
| - builder.nextLine(); |
140 |
| - } |
| 111 | + |
| 112 | + JPanel pan = new JPanel(); |
| 113 | + builder.appendSeparator(Localization.lang("Look and feel")); |
| 114 | + JLabel lab = new JLabel( |
| 115 | + Localization.lang("Default look and feel") + ": " + UIManager.getSystemLookAndFeelClassName()); |
| 116 | + builder.nextLine(); |
| 117 | + builder.append(pan); |
| 118 | + builder.append(lab); |
| 119 | + builder.nextLine(); |
| 120 | + builder.append(pan); |
| 121 | + builder.append(customLAF); |
| 122 | + builder.nextLine(); |
| 123 | + builder.append(pan); |
| 124 | + JPanel pan2 = new JPanel(); |
| 125 | + lab = new JLabel(Localization.lang("Class name") + ':'); |
| 126 | + pan2.add(lab); |
| 127 | + pan2.add(classNamesLAF); |
| 128 | + builder.append(pan2); |
| 129 | + builder.nextLine(); |
| 130 | + builder.append(pan); |
| 131 | + lab = new JLabel(Localization |
| 132 | + .lang("Note that you must specify the fully qualified class name for the look and feel,")); |
| 133 | + builder.append(lab); |
| 134 | + builder.nextLine(); |
| 135 | + builder.append(pan); |
| 136 | + lab = new JLabel( |
| 137 | + Localization.lang("and the class must be available in your classpath next time you start JabRef.")); |
| 138 | + builder.append(lab); |
| 139 | + builder.nextLine(); |
| 140 | + builder.append(pan); |
| 141 | + builder.append(fxFontTweaksLAF); |
| 142 | + builder.nextLine(); |
| 143 | + |
141 | 144 |
|
142 | 145 | builder.leadingColumnOffset(2);
|
143 | 146 |
|
@@ -197,9 +200,9 @@ public AppearancePrefsTab(JabRefPreferences prefs) {
|
197 | 200 | fontButton.addActionListener(
|
198 | 201 | e -> new FontSelectorDialog(null, usedFont).getSelectedFont().ifPresent(x -> usedFont = x));
|
199 | 202 |
|
200 |
| - JPanel pan = builder.getPanel(); |
201 |
| - pan.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
202 |
| - add(pan, BorderLayout.CENTER); |
| 203 | + JPanel panel = builder.getPanel(); |
| 204 | + panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
| 205 | + add(panel, BorderLayout.CENTER); |
203 | 206 | }
|
204 | 207 |
|
205 | 208 | @Override
|
|
0 commit comments