1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-28 09:24:14 +01:00

Load custom L&F from theme

This commit is contained in:
Ricardo JL Rufino 2020-05-13 18:04:34 -03:00
parent 15089f0c54
commit 96e412284f
2 changed files with 23 additions and 7 deletions

View File

@ -250,13 +250,6 @@ public class Base {
Theme.init(); Theme.init();
System.setProperty("swing.aatext", PreferencesData.get("editor.antialias", "true")); System.setProperty("swing.aatext", PreferencesData.get("editor.antialias", "true"));
// Set the look and feel before opening the window
try {
BaseNoGui.getPlatform().setLookAndFeel();
} catch (Exception e) {
// ignore
}
// Use native popups so they don't look so crappy on osx // Use native popups so they don't look so crappy on osx
JPopupMenu.setDefaultLightWeightPopupEnabled(false); JPopupMenu.setDefaultLightWeightPopupEnabled(false);
} else { } else {

View File

@ -57,6 +57,7 @@ import java.util.TreeMap;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
import javax.swing.UIManager;
import javax.swing.text.StyleContext; import javax.swing.text.StyleContext;
import org.apache.batik.transcoder.Transcoder; import org.apache.batik.transcoder.Transcoder;
@ -344,6 +345,28 @@ public class Theme {
// clone the hash table // clone the hash table
defaults = new PreferencesMap(table); defaults = new PreferencesMap(table);
// Set the look and feel before opening the window
try {
String laf = defaults.get("ui.laf");
if(laf != null && ! laf.trim().isEmpty()) {
try {
UIManager.setLookAndFeel(laf);
} catch (Exception e) {
e.printStackTrace();
BaseNoGui.getPlatform().setLookAndFeel();
}
}else {
BaseNoGui.getPlatform().setLookAndFeel();
}
} catch (Exception e) {
// ignore
}
} }
static private ZippedTheme openZipTheme() { static private ZippedTheme openZipTheme() {